35
33
self.assert_(isinstance(bzrlib.version_string, str))
36
34
self.assert_(isinstance(bzrlib.version_info, tuple))
37
35
self.assertEqual(len(bzrlib.version_info), 5)
38
class TrivialObject(object):
39
"""This class allows assignment to any attribute."""
42
class TestAPIVersioning(TestCase):
44
def test_get_minimum_api_version_reads_api_minimum_version(self):
45
an_object = TrivialObject()
46
an_object.api_minimum_version = (0, 1, 2)
47
self.assertEqual((0, 1, 2),
48
bzrlib.api.get_minimum_api_version(an_object))
50
def test_get_minimum_api_version_fallsback_to_bzr_minimum_version(self):
51
an_object = TrivialObject()
52
self.assertEqual(bzrlib.api_minimum_version,
53
bzrlib.api.get_minimum_api_version(an_object))
55
def test_get_current_api_version_reads_api_current_version(self):
56
an_object = TrivialObject()
57
an_object.api_current_version = (3, 2, 1)
58
an_object.version_info = (1, 2, 3, "final", 0)
59
self.assertEqual((3, 2, 1),
60
bzrlib.api.get_current_api_version(an_object))
62
def test_get_current_api_version_fallsback_to_version_info(self):
63
an_object = TrivialObject()
64
an_object.version_info = (1, 2, 3, "final", 0)
65
self.assertEqual((1, 2, 3),
66
bzrlib.api.get_current_api_version(an_object))
68
def test_get_current_api_version_fallsback_to_bzrlib_version_info(self):
69
an_object = TrivialObject()
70
self.assertEqual(bzrlib.version_info[0:3],
71
bzrlib.api.get_current_api_version(an_object))