diff options
author | cpopa <devnull@localhost> | 2014-04-14 16:39:47 +0300 |
---|---|---|
committer | cpopa <devnull@localhost> | 2014-04-14 16:39:47 +0300 |
commit | 7678723873ca872d9f92032fc7cb8cc93709ad9a (patch) | |
tree | 9c4ed056c5d77a74275021c8996745babd10ca0f /test/input/func_format_py27.py | |
parent | ea2e75a77c1a5357863b8ff495cb028c99ecc574 (diff) | |
download | pylint-7678723873ca872d9f92032fc7cb8cc93709ad9a.tar.gz |
Fix tests for < Python 2.7.
Diffstat (limited to 'test/input/func_format_py27.py')
-rw-r--r-- | test/input/func_format_py27.py | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/test/input/func_format_py27.py b/test/input/func_format_py27.py new file mode 100644 index 0000000..828a180 --- /dev/null +++ b/test/input/func_format_py27.py @@ -0,0 +1,108 @@ +# pylint:disable=C0103,W0104,W0105 +"""Check format +""" +__revision__ = '' + +notpreceded= 1 +notfollowed =1 +notfollowed <=1 + +correct = 1 +correct >= 1 + +def func(arg, arg2): + """test named argument + """ + func(arg=arg+1, + arg2=arg2-arg) + +aaaa,bbbb = 1,2 +aaaa |= bbbb +aaaa &= bbbb + + +if aaaa: pass +else: + aaaa,bbbb = 1,2 + aaaa,bbbb = bbbb,aaaa + +bbbb = (1,2,3) + +aaaa = bbbb[1:] +aaaa = bbbb[:1] +aaaa = bbbb[:] + +aaaa = {aaaa:bbbb} + + +# allclose(x,y) uses |x-y|<ATOL+RTOL*|y| +"""docstring,should not match +isn't it:yes! +a=b +""" +aaaa = 'multiple lines\ +string,hehehe' + + +boo = 2 # allclose(x,y) uses |x-y|<ATOL+RTOL*|y| + +def other(funky): + """yo, test formatted result with indentation""" + funky= funky+2 + +html = """<option value="=">ist genau gleich</option> +yo+=4 +""" +html2 = """<option value='='>ist genau gleich</option> +yo+=4 +""" + +func('''<body>Hello +</body>''', 0) + +assert boo <= 10, "Note is %.2f. Either you cheated, or pylint's \ +broken!" % boo + +def _gc_debug(gcc): + """bad format undetected w/ py2.5""" + ocount = {} + for obj in gcc.get_objects(): + try: + ocount[obj.__class__]+= 1 + except KeyError: + ocount[obj.__class__]=1 + except AttributeError: + pass + +def hop(context): + """multi-lines string""" + return ['''<a id="sendbutton" href="javascript: $('%(domid)s').submit()"> +<img src="%(sendimgpath)s" alt="%(send)s"/>%(send)s</a>''' % context, + '''<a id="cancelbutton" href="javascript: history.back()"> +<img src="%(cancelimgpath)s" alt="%(cancel)s"/>%(cancel)s</a>''' % context, + ] +titreprojet = '<tr><td colspan="10">\ +<img src="images/drapeau_vert.png" alt="Drapeau vert" />\ +<strong>%s</strong></td></tr>' % aaaa + +with open('a') as a, open('b') as b: + pass + +with open('a') as a, open('b') as b: pass # multiple-statements + +# Well-formatted try-except-finally block. +try: + pass +except IOError, e: + print e +finally: + pass + +try: + pass +except IOError, e: + print e +finally: pass # multiple-statements + +# This is not allowed by the default configuration. +if True: print False |