Rename 'RequirementSpec' to 'Spec'.

Signed-off-by: Raphaël Barrois <raphael.barrois@polyconseil.fr>
This commit is contained in:
Raphaël Barrois
2012-05-15 16:41:18 +02:00
parent 789e7ab6f2
commit 8b860d5880
3 changed files with 7 additions and 7 deletions

View File

@@ -5,4 +5,4 @@
__version__ = '0.1.0'
from .base import compare, match, SemanticVersion, RequirementSpec
from .base import compare, match, SemanticVersion, Spec

View File

@@ -210,7 +210,7 @@ class SemanticVersion(object):
return 0
class RequirementSpec(object):
class Spec(object):
"""A requirement specification."""
KIND_LT = '<'
@@ -267,4 +267,4 @@ def compare(v1, v2):
def match(spec, version):
return RequirementSpec(spec).match(SemanticVersion(version))
return Spec(spec).match(SemanticVersion(version))

View File

@@ -68,19 +68,19 @@ class MatchTestCase(unittest.TestCase):
def test_invalid(self):
for invalid in self.invalid_specs:
self.assertRaises(ValueError, semantic_version.RequirementSpec, invalid)
self.assertRaises(ValueError, semantic_version.Spec, invalid)
def test_simple(self):
for valid in self.valid_specs:
version = semantic_version.RequirementSpec(valid)
version = semantic_version.Spec(valid)
self.assertEqual(valid, str(version))
def test_match(self):
for spec_txt, versions in self.matches.items():
spec = semantic_version.RequirementSpec(spec_txt)
spec = semantic_version.Spec(spec_txt)
self.assertNotEqual(spec, spec_txt)
for version_txt in versions:
version = semantic_version.SemanticVersion(version_txt)
self.assertTrue(spec.match(version), "%r does not match %r" % (version, spec))
self.assertTrue(semantic_version.match(spec_txt, version_txt))