Example #1
0
    def test_imports_with_import_error_caught_the_other_way(self):
        self.assertFalse(
            main.warnings_for_string("""\
try:
    from configparser import RawConfigParser
except ImportError:
    from ConfigParser import RawConfigParser
"""))
Example #2
0
    def _test_code(self, name, casename=None):
        warnings = main.warnings_for_string(globals()['code_' + name], name)

        if not casename:
            casename = 'Fix' + name.title()

        self.assertTrue(len(warnings))

        self.assertTrue(casename in warnings[0][1])

        return warnings
Example #3
0
 def test_ignore_compatible_raw_input(self):
     self.assertFalse(
         main.warnings_for_string('raw_input = input\nraw_input()\n'))
Example #4
0
 def test_raw_input(self):
     self.assertTrue(main.warnings_for_string('raw_input()\n'))
Example #5
0
 def test_ignore_compatible_zip(self):
     self.assertFalse(
         main.warnings_for_string('enumerate(zip([1, 2], [3, 4]))\n'))
Example #6
0
 def test_zip(self):
     self.assertTrue(main.warnings_for_string('zip([1, 2], [3, 4])\n'))
Example #7
0
 def test_ignore_compatible_long(self):
     self.assertFalse(main.warnings_for_string('long = int\nlong\n'))
Example #8
0
 def test_ignore_compatible_unichr(self):
     self.assertFalse(main.warnings_for_string('unichr = chr\nunichr(1)\n'))
Example #9
0
 def test_print_with_parentheses(self):
     self.assertFalse(main.warnings_for_string('print("%d" % 3)\n'))
Example #10
0
    def test_imports(self):
        self.assertTrue(
            main.warnings_for_string("""\
from ConfigParser import RawConfigParser
"""))
Example #11
0
 def test_print(self):
     self.assertTrue(main.warnings_for_string('print 3\n'))
Example #12
0
 def test_xrange(self):
     self.assertTrue(main.warnings_for_string('xrange(3)\n'))
Example #13
0
 def test_ignore_compatible_basestring(self):
     self.assertFalse(
         main.warnings_for_string('basestring = str\nbasestring\n'))
Example #14
0
 def test_do_not_crash_on_unicode(self):
     main.warnings_for_string('u"å"')
Example #15
0
 def test_long(self):
     self.assertTrue(main.warnings_for_string('long\n'))
Example #16
0
 def test_ignore_compatible_unicode(self):
     self.assertFalse(
         main.warnings_for_string('unicode = str\nunicode("abc")\n'))
Example #17
0
 def test_unichr(self):
     self.assertTrue(main.warnings_for_string('unichr(1)\n'))