def test_fulfills_version_spec(self): test_parameters = [ (["1.0.0", "14.0.1", "16.0.0", "2.0.0"], "==", "1.0.0", True), (["1.0.0", "14.0.1", "16.0.0", "2.0.0"], ">=", "1.0.0", True), (["1.0.0", "14.0.1", "16.0.0", "2.0.0"], ">", "1.0.0", True), (["1.0.0", "14.0.1", "16.0.0", "2.0.0"], "<", "2.0.0", True), (["1.0.0", "14.0.1", "16.0.0", "2.0.0"], "<=", "2.0.0", True), (["1.0.0", "14.0.1", "16.0.0", "2.0.0"], "!=", "1.0.0", True), (["1.0.0", "14.0.1", "16.0.0", "2.0.0"], "==", "17.0.0", False), (["1.0.0"], "!=", "1.0.0", False), ([], "==", "17.0.0", False), ] for installed_versions, operator, version, expected_result in test_parameters: msg = "installed_versions: {}, operator: {}, version: {}, expected_result: {}".format(installed_versions, operator, version, expected_result) self.assertEqual(expected_result, pkg._fulfills_version_spec(installed_versions, operator, version), msg)
def test_fulfills_version_spec(installed_versions, operator, version, expected_result): msg = "installed_versions: {}, operator: {}, version: {}, expected_result: {}".format( installed_versions, operator, version, expected_result) assert expected_result == pkg._fulfills_version_spec( installed_versions, operator, version)