Esempio n. 1
0
    def test_has_line_changed__single_line(self):
        filename = 'some.js'
        pull_file = create_pull_files(self.single_line_add_json)
        changes = DiffCollection(pull_file)

        self.assertTrue(changes.has_line_changed(filename, 1))
        self.assertFalse(changes.has_line_changed(filename, 0))
        self.assertFalse(changes.has_line_changed(filename, 2))
Esempio n. 2
0
    def test_has_line_changed__single_line(self):
        filename = 'some.js'
        pull_file = create_pull_files(self.single_line_add_json)
        changes = DiffCollection(pull_file)

        self.assertTrue(changes.has_line_changed(filename, 1))
        self.assertFalse(changes.has_line_changed(filename, 0))
        self.assertFalse(changes.has_line_changed(filename, 2))
Esempio n. 3
0
    def test_has_line_changed__two_files(self):
        changes = DiffCollection(self.two_files)
        filename = 'Console/Command/Task/AssetBuildTask.php'

        # True for additions
        self.assertTrue(changes.has_line_changed(filename, 117))
        self.assertTrue(changes.has_line_changed(filename, 119))

        # Should return false if the line was a deletion
        self.assertFalse(changes.has_line_changed(filename, 148))

        # Should return false for unchanged
        self.assertFalse(changes.has_line_changed(filename, 145))
Esempio n. 4
0
    def test_has_line_changed__two_files(self):
        changes = DiffCollection(self.two_files)
        filename = 'Console/Command/Task/AssetBuildTask.php'

        # True for additions
        self.assertTrue(changes.has_line_changed(filename, 117))
        self.assertTrue(changes.has_line_changed(filename, 119))

        # Should return false if the line was a deletion
        self.assertFalse(changes.has_line_changed(filename, 148))

        # Should return false for unchanged
        self.assertFalse(changes.has_line_changed(filename, 145))
Esempio n. 5
0
 def test_has_line_changed__no_line(self):
     changes = DiffCollection(self.two_files)
     self.assertFalse(changes.has_line_changed(
         'Console/Command/Task/AssetBuildTask.php',
         99999))
Esempio n. 6
0
 def test_has_line_changed__no_file(self):
     changes = DiffCollection(self.two_files)
     self.assertFalse(changes.has_line_changed('derp', 99))
Esempio n. 7
0
 def test_has_line_changed__no_line(self):
     changes = DiffCollection(self.two_files)
     self.assertFalse(
         changes.has_line_changed('Console/Command/Task/AssetBuildTask.php',
                                  99999))
Esempio n. 8
0
 def test_has_line_changed__no_file(self):
     changes = DiffCollection(self.two_files)
     self.assertFalse(changes.has_line_changed('derp', 99))