Exemplo n.º 1
0
    def test_get_version(self):
        """Test the get_version function."""
        if sys.version_info[0] > 2:
            extra = [(('object', 'builtins'), -1)]
        else:
            extra = []
        c = Classic()
        v = version_registry.get_version(c)
        res = extra + [(('Classic', __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(c)
        self.assertEqual(state.__metadata__['version'], res)

        n = New()
        v = version_registry.get_version(n)
        res = extra + [(('New', __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(n)
        self.assertEqual(state.__metadata__['version'], res)

        t = TraitClass()
        v = version_registry.get_version(t)
        res = extra + [(('CHasTraits', 'traits.ctraits'), -1),
               (('HasTraits', 'traits.has_traits'), -1),
               (('TraitClass', __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(t)
        self.assertEqual(state.__metadata__['version'], res)
Exemplo n.º 2
0
    def test_get_version(self):
        """Test the get_version function."""
        if sys.version_info[0] > 2:
            extra = [(('object', 'builtins'), -1)]
        else:
            extra = []
        c = Classic()
        v = version_registry.get_version(c)
        res = extra + [(('Classic', __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(c)
        self.assertEqual(state.__metadata__['version'], res)

        n = New()
        v = version_registry.get_version(n)
        res = extra + [(('New', __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(n)
        self.assertEqual(state.__metadata__['version'], res)

        t = TraitClass()
        v = version_registry.get_version(t)
        res = extra + [(('CHasTraits', 'traits.ctraits'), -1),
                       (('HasTraits', 'traits.has_traits'), -1),
                       (('TraitClass', __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(t)
        self.assertEqual(state.__metadata__['version'], res)
    def test_get_version(self):
        """Test the get_version function."""
        c = Classic()
        v = version_registry.get_version(c)
        res = [(("Classic", __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(c)
        self.assertEqual(state.__metadata__["version"], res)

        n = New()
        v = version_registry.get_version(n)
        res = [(("New", __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(n)
        self.assertEqual(state.__metadata__["version"], res)

        t = TraitClass()
        v = version_registry.get_version(t)
        res = [
            (("CHasTraits", "traits.ctraits"), -1),
            (("HasTraits", "traits.has_traits"), -1),
            (("TraitClass", __name__), 0),
        ]
        self.assertEqual(v, res)
        state = state_pickler.get_state(t)
        self.assertEqual(state.__metadata__["version"], res)
Exemplo n.º 4
0
    def test_get_version(self):
        """Test the get_version function."""
        extra = [(("object", "builtins"), -1)]
        c = Classic()
        v = version_registry.get_version(c)
        res = extra + [(("Classic", __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(c)
        self.assertEqual(state.__metadata__["version"], res)

        n = New()
        v = version_registry.get_version(n)
        res = extra + [(("New", __name__), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(n)
        self.assertEqual(state.__metadata__["version"], res)

        t = TraitClass()
        v = version_registry.get_version(t)
        res = extra + [
            (("CHasTraits", "traits.ctraits"), -1),
            (("HasTraits", "traits.has_traits"), -1),
            (("TraitClass", __name__), 0),
        ]
        self.assertEqual(v, res)
        state = state_pickler.get_state(t)
        self.assertEqual(state.__metadata__["version"], res)
Exemplo n.º 5
0
    def test_get_version(self):
        """Test the get_version function."""
        c = Classic()
        v = version_registry.get_version(c)
        res = [(('Classic', '__main__'), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(c)
        self.assertEqual(state.__metadata__['version'], res)

        n = New()
        v = version_registry.get_version(n)
        res = [(('New', '__main__'), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(n)
        self.assertEqual(state.__metadata__['version'], res)

        t = TraitClass()
        v = version_registry.get_version(t)
        res = [(('HasTraits', 'traits.has_traits'), -1),
               (('TraitClass', '__main__'), 0)]
        self.assertEqual(v, res)
        state = state_pickler.get_state(t)
        self.assertEqual(state.__metadata__['version'], res)