diff options
author | Hugo <hugovk@users.noreply.github.com> | 2018-03-18 21:50:16 +0200 |
---|---|---|
committer | Hugo <hugovk@users.noreply.github.com> | 2018-03-18 22:26:31 +0200 |
commit | db0dfa07e34ed80bfe0ce389da946755ada13c5d (patch) | |
tree | db0f3601ad1c44986953678a61ff59e8aa14e1a4 /git | |
parent | 87a644184b05e99a4809de378f21424ef6ced06e (diff) | |
download | gitpython-db0dfa07e34ed80bfe0ce389da946755ada13c5d.tar.gz |
Unnecessary generator - rewrite as a set comprehension
Diffstat (limited to 'git')
-rw-r--r-- | git/test/test_fun.py | 2 | ||||
-rw-r--r-- | git/test/test_index.py | 4 | ||||
-rw-r--r-- | git/test/test_tree.py | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/git/test/test_fun.py b/git/test/test_fun.py index d5e6e50d..314fb734 100644 --- a/git/test/test_fun.py +++ b/git/test/test_fun.py @@ -211,7 +211,7 @@ class TestFun(TestBase): def _assert_tree_entries(self, entries, num_trees): for entry in entries: assert len(entry) == num_trees - paths = set(e[2] for e in entry if e) + paths = {e[2] for e in entry if e} # only one path per set of entries assert len(paths) == 1 diff --git a/git/test/test_index.py b/git/test/test_index.py index 04638c57..c7739ce8 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -147,8 +147,8 @@ class TestIndex(TestBase): blist.append(blob) # END for each blob in tree if len(blist) != len(index.entries): - iset = set(k[0] for k in index.entries.keys()) - bset = set(b.path for b in blist) + iset = {k[0] for k in index.entries.keys()} + bset = {b.path for b in blist} raise AssertionError("CMP Failed: Missing entries in index: %s, missing in tree: %s" % (bset - iset, iset - bset)) # END assertion message diff --git a/git/test/test_tree.py b/git/test/test_tree.py index 3005722f..dc23f29c 100644 --- a/git/test/test_tree.py +++ b/git/test/test_tree.py @@ -88,7 +88,7 @@ class TestTree(TestBase): # trees and blobs assert len(set(trees) | set(root.trees)) == len(trees) - assert len(set(b for b in root if isinstance(b, Blob)) | set(root.blobs)) == len(root.blobs) + assert len({b for b in root if isinstance(b, Blob)} | set(root.blobs)) == len(root.blobs) subitem = trees[0][0] assert "/" in subitem.path assert subitem.name == osp.basename(subitem.path) |