
commit 22667eaa6a02e6585ad502ea164fce15cd96cc1f Author: Damian Johnson <atagar@torproject.org> Date: Mon Nov 21 03:59:27 2011 -0800 Unit test for comparing Version class with others Had a pesky bug where comparison of Version instances with other classes would raise an exception and had forgotten to add a unit test - fixing that. --- test/unit/types/version.py | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/test/unit/types/version.py b/test/unit/types/version.py index 309ee07..067759b 100644 --- a/test/unit/types/version.py +++ b/test/unit/types/version.py @@ -68,6 +68,18 @@ class TestVerion(unittest.TestCase): self.assert_version_is_equal("0.1.2.3", "0.1.2.3") self.assert_version_is_equal("0.1.2", "0.1.2") + def test_nonversion_comparison(self): + """ + Checks that we can be compared with other types. + """ + + test_version = stem.types.Version("0.1.2.3") + self.assertNotEqual(test_version, None) + self.assertTrue(test_version > None) + + self.assertNotEqual(test_version, 5) + self.assertTrue(test_version > 5) + def test_string(self): """ Tests the Version -> string conversion.