1
# Copyright (c) 2010-2011 OpenStack, LLC.
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
20
class TestVersioning(unittest.TestCase):
21
def test_canonical_version_is_clean(self):
22
"""Ensure that a non-clean canonical_version never happens"""
23
pattern = re.compile('^\d+(\.\d+)*$')
24
self.assertTrue(pattern.match(swift.__canonical_version__) is not None)
26
def test_canonical_version_equals_version_for_final(self):
27
version = swift.Version('7.8.9', True)
28
self.assertEquals(version.pretty_version, '7.8.9')
29
self.assertEquals(version.canonical_version, '7.8.9')
31
def test_version_has_dev_suffix_for_non_final(self):
32
version = swift.Version('7.8.9', False)
33
self.assertEquals(version.pretty_version, '7.8.9-dev')
34
self.assertEquals(version.canonical_version, '7.8.9')
36
if __name__ == '__main__':