[openstack-dev] [Hacking] unit test code is too less

Sascha Peilicke speilicke at suse.com
Thu Jan 23 17:04:30 UTC 2014


On Thursday 23 January 2014 12:06:37 Dirk Müller wrote:
> Hi Zhi Qiang,
> 
> > for i.e. the hacking rule h233 in hacking looks not so robust,
> > https://github.com/openstack-dev/hacking/blob/master/hacking/core.py#L345
> > it cannot detect
> > 
> > \bprint$
> > \bprint >>>xxx, (\s+
> 
> It currently detects both as a violation of the rule, which is IMHO
> correct. Please note that the behavior of
> 
>   print
> 
> depends on if its an operator (then it prints a newline) and a
> function (then it does nothing)

Wrong:

	% python
	Python 2.7.6 (default, Nov 21 2013, 15:55:38) [GCC] on linux2
	>>> print
	
	>>> from __future__ import print_function
	>>> print()
	
	>>> 
	% python3
	Python 3.3.3 (default, Nov 19 2013, 16:19:14) [GCC] on linux
	>>> print()
	
	>>> 

Python3 just broke "Hello, world!", but they tried to follow the principle of 
least surprise :-)
-- 
Sascha Peilicke
SUSE Linux GmbH, Maxfeldstr. 5, D-90409 Nuernberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer HRB 16746 (AG Nürnberg) 



More information about the OpenStack-dev mailing list