summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@spacinov.com>2023-02-28 11:51:59 +0100
committerRaphaël Barrois <raphael.barrois@spacinov.com>2023-02-28 11:51:59 +0100
commit2cbbee3154d9011cee873ae3a020cd17c669f6df (patch)
treeb3398bc0e48fd0ac4a5ea06d924d6effba376b3a /tests
parent9acf55af9d6361a3eac576f9df076507165e8cfe (diff)
downloadsemantic-version-master.tar.gz
Simplify subclassing VersionHEADsubclasseablemaster
Fixes: #112
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_base.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_base.py b/tests/test_base.py
index 73d1b08..4136045 100755
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -405,6 +405,15 @@ class VersionTestCase(unittest.TestCase):
self.assertEqual(v.truncate("minor"), base.Version("3.2.0"))
self.assertEqual(v.truncate("major"), base.Version("3.0.0"))
+ def test_subclass(self):
+ """Custom subclasses of Version returns instances of themselves."""
+ class MyVersion(base.Version):
+ pass
+
+ v = MyVersion("3.2.1-pre")
+ subv = v.truncate()
+ self.assertEqual(type(subv), MyVersion)
+
class SpecItemTestCase(unittest.TestCase):
if sys.version_info[0] <= 2: