Пример #1
0
 def test_append_added_line(self):
     hunk = Hunk(src_len=0, tgt_len=1)
     hunk.append_added_line(self.sample_line)
     self.assertTrue(hunk.is_valid())
     self.assertEqual(len(hunk.target_lines), 1)
     self.assertEqual(hunk.source_lines, [])
     self.assertIn(self.sample_line, hunk.target_lines)
Пример #2
0
 def test_append_added_line(self):
     hunk = Hunk(src_len=0, tgt_len=1)
     hunk.append_added_line(self.sample_line)
     self.assertTrue(hunk.is_valid())
     self.assertEqual(len(hunk.target_lines), 1)
     self.assertEqual(hunk.source_lines, [])
     self.assertIn(self.sample_line, hunk.target_lines)
Пример #3
0
 def test_modified_counter(self):
     hunk = Hunk(src_len=1, tgt_len=1)
     hunk.append_deleted_line(self.sample_line)
     hunk.append_added_line(self.sample_line)
     hunk.add_to_modified_counter(1)
     self.assertTrue(hunk.is_valid())
     self.assertEqual(hunk.modified, 1)
     self.assertEqual(hunk.added, 0)
     self.assertEqual(hunk.deleted, 0)
Пример #4
0
 def test_modified_counter(self):
     hunk = Hunk(src_len=1, tgt_len=1)
     hunk.append_deleted_line(self.sample_line)
     hunk.append_added_line(self.sample_line)
     hunk.add_to_modified_counter(1)
     self.assertTrue(hunk.is_valid())
     self.assertEqual(hunk.modified, 1)
     self.assertEqual(hunk.added, 0)
     self.assertEqual(hunk.deleted, 0)