def test_returns_singleton(self): """ Validates that the getter returns the same global registry """ # Just try it a few times. self.assertEqual(self.registry, sweet_pickle.get_global_registry()) self.assertEqual(self.registry, sweet_pickle.get_global_registry()) self.assertEqual(self.registry, sweet_pickle.get_global_registry())
def setUp(self): """ Creates the test fixture. Overridden here to ensure each test starts with an empty global registry. """ # Clear the global registry _clear_global_registry() # Cache a reference to the new global registry self.registry = sweet_pickle.get_global_registry()
def setUp(self): """ Creates the test fixture. Overridden here to ensure each test starts with an empty global registry. """ # Clear the global registry _clear_global_registry() # Cache a reference to the new global registry self.registry = sweet_pickle.get_global_registry() # Add the class mappings to the registry self.registry.add_mapping_to_class(Foo.__module__, Foo.__name__, Bar) self.registry.add_mapping_to_class(Bar.__module__, Bar.__name__, Baz)
def test_clearing(self): """ Validates that clearing the registry gives us a new registry. """ _clear_global_registry() self.assertNotEqual(self.registry, sweet_pickle.get_global_registry())