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")
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")
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')
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')
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 )
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)