def test_declarative(self, m_venusian): @pform.field('my-field') class MyField(pform.Field): pass wrp, cb = m_venusian.attach.call_args[0] self.assertIs(wrp, MyField) m_venusian.config.with_package.return_value = self.config cb(m_venusian, 'my-field', MyField) self.assertIs(pform.get_field_factory(self.request, 'my-field'), MyField)
def test_imperative(self): class MyField(pform.Field): """ """ self.config.provide_form_field('my-field', MyField) self.assertIs(pform.get_field_factory(self.request, 'my-field'), MyField)