Exemplo n.º 1
0
 def test_check_startswith_endswith_ends_with_second(self):
     ex2 = 'line: 41, column: {0} use ".endswith()"'\
       ' instead of cutting from strings to test suffixes'
     result1 = t.check_startswith_endswith('a[4:len(a) - 1] == "abcd"', 41)
     result2 = t.check_startswith_endswith('a[4:len(a) - 1] != "abcd"', 41)
     self.assertEqual(result1, ex2.format(3))
     self.assertEqual(result2, ex2.format(3))
Exemplo n.º 2
0
 def test_check_startswith_endswith_starts_with_second(self):
     ex1 = 'line: 38, column: {0} use ".startswith()"' \
           ' instead of cutting from strings to test prefixes'
     result1 = t.check_startswith_endswith('a[0:4] == "abcd"', 38)
     result2 = t.check_startswith_endswith('a[0:4] != "abcd"', 38)
     self.assertEqual(result1, ex1.format(1))
     self.assertEqual(result2, ex1.format(1))
Exemplo n.º 3
0
 def test_check_startswith_endswith_ends_with_good(self):
     result1 = t.check_startswith_endswith('a.endswith("abcd")', 42)
     result2 = t.check_startswith_endswith('not a.endswith("abcd")', 42)
     self.assertEqual(result1, None)
     self.assertEqual(result2, None)