Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Significant contributors
* Craig Blaszczyk <[email protected]>
* Jan Pieter Waagmeester <[email protected]>
* Jelo Agnasin <[email protected]>
* Karol Werner <karol[email protected]>
* Karol Werner <karol@ppkt.eu>
* Peter Bittner <[email protected]>
* robi-wan <[email protected]>
* T. Jameson Little <[email protected]>
Expand Down
4 changes: 4 additions & 0 deletions semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def _asdict(self):
("build", self.build)
))

def __iter__(self):
for v in self._astuple():
yield v

def __eq__(self, other):
if not isinstance(other, (VersionInfo, dict)):
return NotImplemented
Expand Down
6 changes: 6 additions & 0 deletions test_semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,3 +460,9 @@ def test_immutable():
pass
else:
assert 0, "no new attribute can be set"


def test_version_info_should_be_iterable():
v = VersionInfo(major=1, minor=2, patch=3,
prerelease='alpha.1.2', build='build.11.e0f985a')
assert tuple(v) == v._astuple()