예제 #1
0
 def test_skip_one_score_match_longer_than_one_token(self):
     file_changes = [
         self.create_commitfilechange(filename="hello/app.py", type="A"),
         self.create_commitfilechange(filename="hello/world/app.py", type="A"),
         self.create_commitfilechange(filename="hello/world/template/app.py", type="A"),
     ]
     assert [] == _match_commits_path(file_changes, "app.py")
예제 #2
0
 def test_simple(self):
     file_change = self.create_commitfilechange(filename="hello/app.py", type="A")
     file_changes = [
         file_change,
         self.create_commitfilechange(filename="goodbye/app.js", type="A"),
     ]
     assert [(file_change.commit, 2)] == _match_commits_path(file_changes, "hello/app.py")
예제 #3
0
 def test_skip_one_score_match_longer_than_one_token(self):
     file_changes = [
         self.create_commitfilechange(filename='hello/app.py', type='A'),
         self.create_commitfilechange(filename='hello/world/app.py', type='A'),
         self.create_commitfilechange(filename='hello/world/template/app.py', type='A')
     ]
     assert [] == _match_commits_path(file_changes, 'app.py')
예제 #4
0
 def test_simple(self):
     file_change = self.create_commitfilechange(filename='hello/app.py', type='A')
     file_changes = [
         file_change,
         self.create_commitfilechange(filename='goodbye/app.js', type='A'),
     ]
     assert [(file_change.commit, 2)] == _match_commits_path(file_changes, 'hello/app.py')
예제 #5
0
    def test_similar_paths(self):
        file_changes = [
            self.create_commitfilechange(filename="hello/app.py", type="A"),
            self.create_commitfilechange(filename="world/hello/app.py", type="A"),
            self.create_commitfilechange(filename="template/hello/app.py", type="A"),
        ]

        commits = sorted([(fc.commit, 2) for fc in file_changes], key=lambda fc: fc[0].id)
        assert commits == sorted(
            _match_commits_path(file_changes, "hello/app.py"), key=lambda fc: fc[0].id
        )
예제 #6
0
    def test_similar_paths(self):
        file_changes = [
            self.create_commitfilechange(filename='hello/app.py', type='A'),
            self.create_commitfilechange(filename='world/hello/app.py', type='A'),
            self.create_commitfilechange(filename='template/hello/app.py', type='A')
        ]

        commits = sorted([(fc.commit, 2) for fc in file_changes], key=lambda fc: fc[0].id)
        assert commits == sorted(
            _match_commits_path(
                file_changes,
                'hello/app.py'),
            key=lambda fc: fc[0].id)