def test_get_latest_version_within_specs(self): latest = Requirement.get_latest_version_within_specs( (("==", "1.2"), ("!=", "1.2")), ["1.2", "1.3", "1.4", "1.5"]) self.assertEqual(latest, None) latest = Requirement.get_latest_version_within_specs( (("==", "1.2.1"), ), ["1.2.0", "1.2.1", "1.2.2", "1.3"]) self.assertEqual(latest, "1.2.1")
def test_get_latest_version_within_specs(self): latest = Requirement.get_latest_version_within_specs( (("==", "1.2"), ("!=", "1.2")), ["1.2", "1.3", "1.4", "1.5"] ) self.assertEqual(latest, None) latest = Requirement.get_latest_version_within_specs( (("==", "1.2.1"),), ["1.2.0", "1.2.1", "1.2.2", "1.3"] ) self.assertEqual(latest, "1.2.1")
def test_get_latest_version_within_specs(self): from packaging.specifiers import SpecifierSet latest = Requirement.get_latest_version_within_specs( SpecifierSet("==1.2,!=1.2"), ["1.2", "1.3", "1.4", "1.5"] ) self.assertEqual(latest, None) latest = Requirement.get_latest_version_within_specs( SpecifierSet("==1.2.1"), ["1.2.0", "1.2.1", "1.2.2", "1.3"] ) self.assertEqual(latest, "1.2.1")