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

ZhiQiang Fan aji.zqfan at gmail.com
Thu Jan 23 11:19:44 UTC 2014


Hi, Dirk

If a line just with single print (which means a function name) does
nothing, I think it should be removed,

print$ cannot be detected by  "\bprint\s+[^\(]"

>>> import re
>>> print re.search(r"\bprint\s+[^\(]", "print")
None
>>> print re.search(r"\bprint(?:$|\s+[^\(])", "print")
<_sre.SRE_Match object at 0xb6c2bfa8>


On Thu, Jan 23, 2014 at 7:06 PM, Dirk Müller <dirk at dmllr.de> 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)
>
>
> Greetings,
> Dirk
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
blog: zqfan.github.com
git: github.com/zqfan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140123/fa8f2311/attachment.html>


More information about the OpenStack-dev mailing list