Пример #1
0
def test_parse_version_string(version_string, expected_version_conditions):
    version_conditions = pkg._parse_version_string(version_string)
    assert len(expected_version_conditions) == len(version_conditions)
    for expected_version_condition, version_condition in zip(
            expected_version_conditions, version_conditions):
        assert expected_version_condition[0] == version_condition[0]
        assert expected_version_condition[1] == version_condition[1]
Пример #2
0
 def test_parse_version_string(self):
     test_parameters = [("> 1.0.0, < 15.0.0, != 14.0.1", [(">", "1.0.0"),
                                                          ("<", "15.0.0"),
                                                          ("!=", "14.0.1")
                                                          ]),
                        ("> 1.0.0,< 15.0.0,!= 14.0.1", [(">", "1.0.0"),
                                                        ("<", "15.0.0"),
                                                        ("!=", "14.0.1")]),
                        (">= 1.0.0, < 15.0.0", [(">=", "1.0.0"),
                                                ("<", "15.0.0")]),
                        (">=1.0.0,< 15.0.0", [(">=", "1.0.0"),
                                              ("<", "15.0.0")]),
                        ("< 15.0.0", [("<", "15.0.0")]),
                        ("<15.0.0", [("<", "15.0.0")]),
                        ("15.0.0", [("==", "15.0.0")]), ("", [])]
     for version_string, expected_version_conditions in test_parameters:
         version_conditions = pkg._parse_version_string(version_string)
         self.assertEqual(len(expected_version_conditions),
                          len(version_conditions))
         for expected_version_condition, version_condition in zip(
                 expected_version_conditions, version_conditions):
             self.assertEqual(expected_version_condition[0],
                              version_condition[0])
             self.assertEqual(expected_version_condition[1],
                              version_condition[1])