Skip to content

Commit

Permalink
Extend tests for newer_pairwise and fix failed expectation when no fi…
Browse files Browse the repository at this point in the history
…les are newer.
  • Loading branch information
jaraco committed Nov 5, 2023
1 parent 9494203 commit ce9efc4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion distutils/_modified.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def newer_pairwise(sources, targets):
of 'newer()'.
"""
newer_pairs = filter(splat(newer), zip_strict(sources, targets))
return tuple(map(list, zip(*newer_pairs)))
return tuple(map(list, zip(*newer_pairs))) or ([], [])


def newer_group(sources, target, missing='error'):
Expand Down
8 changes: 8 additions & 0 deletions distutils/tests/test_modified.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ def test_newer_pairwise_mismatch(self):
with pytest.raises(ValueError):
newer_pairwise([one, two], [three])

def test_newer_pairwise_empty(self):
assert newer_pairwise([], []) == ([], [])

def test_newer_pairwise_fresh(self):
one, two, three, four = self._setup_1234()

assert newer_pairwise([one, three], [two, four]) == ([], [])

def test_newer_group(self):
tmpdir = self.mkdtemp()
sources = os.path.join(tmpdir, 'sources')
Expand Down

0 comments on commit ce9efc4

Please sign in to comment.