Project

Profile

Help

Test #6408

Unit test for is_previous_revision

Added by fao89 5 months ago.

Status:
NEW
Priority:
Normal
Assignee:
-
Sprint/Milestone:
-
Version:
Platform Release:
Tags:
Sprint:

Description

https://github.com/pulp/pulp_rpm/blob/master/pulp_rpm/app/shared_utils.py#L35

is_previous_revision is utilized on sync optimization, we need to test if it could handle revisions in many formats (timestamp, string, None).

Compare revisions in many formats

is_previous_revision("3.0.0", "2.0.0") -> False
is_previous_revision("2.0.0", "3.0.0") -> True
is_previous_revision("2.0.0", "2.0.0") -> True
is_previous_revision(1234, 1235) -> True  #timestamp
is_previous_revision(1235, 1234) -> False  #timestamp
is_previous_revision(1235, "2.0.0") -> False
is_previous_revision("2.0.0", 1235) -> False
is_previous_revision("3.1.0", "2.15.0") -> False
is_previous_revision("2.15.0", "3.1.0") -> True
is_previous_revision(None, "3.1.0") -> False
is_previous_revision("3.1.0", None) -> False
is_previous_revision(None, 1234) -> False
is_previous_revision(1235, None) -> False 

pytest parametrize: http://doc.pytest.org/en/latest/example/parametrize.html#parametrizing-conditional-raising

Please register to edit this issue

Also available in: Atom PDF