

def build_version_test(name, version_case):
    '\n    Create a test case that checks that a given version\n    is interpreted as expected.\n    '

    class Tests(TestCase):

        def test_flocker_version(self):
            '\n            The parsed version matches the expected parsed version.\n            '
            self.assertEqual(parse_version(version_case.version), version_case.flocker_version, "Version doesn't match expected parsed version.")

        def test_doc_version(self):
            '\n            The calculated doc version matches the expected doc version.",\n            '
            self.assertEqual(get_doc_version(version_case.version), version_case.doc_version, "Calculated doc version doesn't match expected doc version.")

        @skipIf(version_case.is_legacy, "Legacy version don't generate proper installable version.")
        def test_installable_version(self):
            '\n            The calculated installable version matches the expected installable\n            version.\n            '
            self.assertEqual(get_installable_version(version_case.version), version_case.installable_version, "Calculated installable version doesn't matchexpected installable version.")

        def test_is_release(self):
            '\n            ``is_release`` returns the expected value for the version.\n            '
            self.assertEqual(is_release(version_case.version), version_case.is_release)

        def test_is_weekly_release(self):
            '\n            ``is_weekly_release`` returns the expected value for the version.\n            '
            self.assertEqual(is_weekly_release(version_case.version), version_case.is_weekly_release)

        def test_is_pre_release(self):
            '\n            ``is_pre_release`` returns the expected value for the version.\n            '
            self.assertEqual(is_pre_release(version_case.version), version_case.is_pre_release)

        @skipUnless(PACKAGING_INSTALLED, '``packaging`` not installed.')
        def test_pep_440(self):
            '\n            The version is a valid PEP440 version.\n\n            (``PEP440Version`` raises if provided an invalid version).\n            '
            PEP440Version(version_case.version)

        @skipUnless(PACKAGING_INSTALLED, '``packaging`` not installed.')
        @skipIf(version_case.is_legacy, "Legacy version isn't normalized.")
        def test_normalization(self):
            '\n            The version number is normalized according to PEP440.\n            '
            self.assertEqual(version_case.version, str(PEP440Version(version_case.version)), "Version isn't normalized.")
    Tests.__name__ = version_case
    return Tests

dataset/ETHPy150Open ClusterHQ/flocker/flocker/common/test/test_version.py build_version_test/VarMisuse@290/766 `name`->`version_case`