Dulwich.io dulwich / 3870673
Implement RefsContainer.__iter__. Fixes #717 Jelmer Vernooń≥ 18 days ago
3 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1313
1414 * Mark ``.git`` directories as hidden on Windows.
1515 (Martin Packman, #585)
16
17 * Implement ``RefsContainer.__iter__``
18 (Jelmer Vernooń≥, #717)
1619
1720 0.19.11 2019-02-07
1821
156156 def allkeys(self):
157157 """All refs present in this container."""
158158 raise NotImplementedError(self.allkeys)
159
160 def __iter__(self):
161 return iter(self.allkeys())
159162
160163 def keys(self, base=None):
161164 """Refs present in this container.
184184 self.assertEqual([b'refs-0.1', b'refs-0.2'],
185185 sorted(self._refs.keys(b'refs/tags')))
186186
187 def test_iter(self):
188 actual_keys = set(self._refs.keys())
189 self.assertEqual(set(self._refs), actual_keys)
190 self.assertEqual(set(_TEST_REFS.keys()), actual_keys)
191
187192 def test_as_dict(self):
188193 # refs/heads/loop does not show up even if it exists
189194 expected_refs = dict(_TEST_REFS)