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