Beispiel #1
0
 def test_register_class_existing(self):
     class Test: pass
     register_class(Test)
     # again
     register_class(Test)
     assert 'Test' in registered_classes()
     unregister_class('Test')
     assert 'Test' not in registered_classes()
Beispiel #2
0
    def test_unregister_class(self):
        class Test:
            pass

        register_class(Test)
        assert 'Test' in registered_classes()
        unregister_class('Test')
        assert 'Test' not in registered_classes()
Beispiel #3
0
 def test_unregister_missing_class(self):
     mess = 'not registered with the factory'
     with pytest.raises(KeyError) as excinfo:
         unregister_class('dummy')
     assert mess in str(excinfo.value)