File: calc_release_version_selftest.py

package info (click to toggle)
mongo-cxx-driver 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 13,832 kB
  • sloc: cpp: 61,365; python: 1,436; sh: 356; xml: 253; perl: 215; makefile: 21
file content (15 lines) | stat: -rw-r--r-- 1,230 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import unittest
import calc_release_version


class TestVersionSort(unittest.TestCase):
    def test_version_sort(self):
        # At time of writing, `input_tags` is the output of `git tag -l "r3.*"`:
        input_tags = ["3.0.0", "3.0.0-rc0", "3.0.1", "3.0.2", "3.0.3", "3.1.0", "3.1.0-beta0", "3.1.0-rc0", "3.1.1", "3.1.2", "3.1.3", "3.1.4", "3.2.0", "3.2.0-rc0", "3.2.0-rc1", "3.2.1", "3.3.0", "3.3.0-rc0", "3.3.1", "3.3.2", "3.4.0", "3.4.1", "3.4.2", "3.5.0", "3.5.1", "3.6.0", "3.6.0-rc0", "3.6.1", "3.6.2", "3.6.3", "3.6.4", "3.6.5", "3.6.6", "3.6.7", "3.7.0", "3.7.0-beta1", "3.7.1", "3.7.2", "3.8.0", "3.8.1", "3.9.0"]
        expected_tags = ["3.0.0-rc0", "3.0.0", "3.0.1", "3.0.2", "3.0.3", "3.1.0-beta0", "3.1.0-rc0", "3.1.0", "3.1.1", "3.1.2", "3.1.3", "3.1.4", "3.2.0-rc0", "3.2.0-rc1", "3.2.0", "3.2.1", "3.3.0-rc0", "3.3.0", "3.3.1", "3.3.2", "3.4.0", "3.4.1", "3.4.2", "3.5.0", "3.5.1", "3.6.0-rc0", "3.6.0", "3.6.1", "3.6.2", "3.6.3", "3.6.4", "3.6.5", "3.6.6", "3.6.7", "3.7.0-beta1", "3.7.0", "3.7.1", "3.7.2", "3.8.0", "3.8.1", "3.9.0"]
        got_tags = sorted(input_tags, key=calc_release_version.Version)
        self.assertEqual(got_tags, expected_tags)


if __name__ == "__main__":
    unittest.main()