Exemple #1
0
 def test_should_find_symbol_at_start_of_source(self):
     source = "threading.current_thread"
     offset = 13  # threading.cur_|_rent
     result = nativebackend.find_dotted_symbol_backward(source, offset)
     self.assertEqual(result[0], "threading.cur")
     self.assertEqual(source[result[1]:result[2]],
                      "threading.cur")
Exemple #2
0
 def test_should_find_empty_string_at_start_of_symbol(self):
     source = "foo(threading.current_thread)"
     offset = 4  # foo(_|_thr
     result = nativebackend.find_dotted_symbol_backward(source, offset)
     self.assertEqual(result[0], "")
     self.assertEqual(source[result[1]:result[2]],
                      "")
Exemple #3
0
 def test_should_find_symbol_at_start_of_source(self):
     source = "threading.current_thread"
     offset = 13  # threading.cur_|_rent
     result = nativebackend.find_dotted_symbol_backward(source, offset)
     self.assertEqual(result[0], "threading.cur")
     self.assertEqual(source[result[1]:result[2]],
                      "threading.cur")
Exemple #4
0
 def test_should_find_empty_string_at_start_of_symbol(self):
     source = "foo(threading.current_thread)"
     offset = 4  # foo(_|_thr
     result = nativebackend.find_dotted_symbol_backward(source, offset)
     self.assertEqual(result[0], "")
     self.assertEqual(source[result[1]:result[2]],
                      "")
Exemple #5
0
 def test_should_find_symbol(self):
     source, offset = source_and_offset("foo(threading.current_th_|_read())")
     result = nativebackend.find_dotted_symbol_backward(source, offset)
     self.assertEqual(result[0], "threading.current_th")
     self.assertEqual(source[result[1] : result[2]], "threading.current_th")
     result = nativebackend.find_dotted_symbol(source, offset)
     self.assertEqual(result[0], "threading.current_thread")
     self.assertEqual(source[result[1] : result[2]], "threading.current_thread")
Exemple #6
0
 def test_should_find_symbol(self):
     source, offset = source_and_offset(
         "foo(threading.current_th_|_read())")
     result = nativebackend.find_dotted_symbol_backward(source, offset)
     self.assertEqual(result[0], "threading.current_th")
     self.assertEqual(source[result[1]:result[2]], "threading.current_th")
     result = nativebackend.find_dotted_symbol(source, offset)
     self.assertEqual(result[0], "threading.current_thread")
     self.assertEqual(source[result[1]:result[2]],
                      "threading.current_thread")