Skip to content

Commit 87a6441

Browse files
committed
Unnecessary generator - rewrite as a list comprehension
1 parent 34cce40 commit 87a6441

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

git/test/test_index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def test_index_file_base(self):
127127
# test stage
128128
index_merge = IndexFile(self.rorepo, fixture_path("index_merge"))
129129
self.assertEqual(len(index_merge.entries), 106)
130-
assert len(list(e for e in index_merge.entries.values() if e.stage != 0))
130+
assert len([e for e in index_merge.entries.values() if e.stage != 0])
131131

132132
# write the data - it must match the original
133133
tmpfile = tempfile.mktemp()
@@ -190,7 +190,7 @@ def test_index_file_from_tree(self, rw_repo):
190190

191191
# merge three trees - here we have a merge conflict
192192
three_way_index = IndexFile.from_tree(rw_repo, common_ancestor_sha, cur_sha, other_sha)
193-
assert len(list(e for e in three_way_index.entries.values() if e.stage != 0))
193+
assert len([e for e in three_way_index.entries.values() if e.stage != 0])
194194

195195
# ITERATE BLOBS
196196
merge_required = lambda t: t[0] != 0

git/test/test_tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_traverse(self):
7979
# only choose trees
8080
trees_only = lambda i, d: i.type == "tree"
8181
trees = list(root.traverse(predicate=trees_only))
82-
assert len(trees) == len(list(i for i in root.traverse() if trees_only(i, 0)))
82+
assert len(trees) == len([i for i in root.traverse() if trees_only(i, 0)])
8383

8484
# test prune
8585
lib_folder = lambda t, d: t.path == "lib"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy