Exemplo n.º 1
0
    def testNamedRegistration(self):
        @registry.register_model("model2")
        class MyModel1(vf_model.VfModel):
            pass

        model = registry.model("model2")
        self.assertTrue(model is MyModel1)
Exemplo n.º 2
0
    def testNonT2TModelRegistration(self):
        @registry.register_model
        def model_fn():
            pass

        model = registry.model("model_fn")
        self.assertTrue(model is model_fn)
Exemplo n.º 3
0
    def testT2TModelRegistration(self):
        @registry.register_model
        class MyModel1(vf_model.VfModel):
            pass

        model = registry.model("my_model1")
        self.assertTrue(model is MyModel1)
Exemplo n.º 4
0
def _model(name):
    return registry.model(name)
Exemplo n.º 5
0
 def testUnknownModel(self):
     with self.assertRaisesRegexp(KeyError, "never registered"):
         registry.model("not_registered")