def test_global_inheriting(): class D(Document): f = Field() options.configure(required=not _req()) # Make sure it goes all the way down assert D.f.required == _req() assert D()._fields['f'].required == _req()
def test_document_options_transparency(): class D(Document): pass # Change an option options.configure(required=not _req()) # And make sure it shows up assert D.config_required == _req() assert D().config_required == _req()
def test_field_options_transparency(): class F(Field): pass # Change an option options.configure(required=not _req()) # And make sure it shows up assert F.required == _req() assert F().required == _req()
def test_options_update(): options.configure(namespace='foobar') assert options.CONFIG['namespace'] == 'foobar'
def test_stupid_option(): options.configure(foobar=True)
def test_wrong_arg(): options.configure(1)
def test_too_many_args(): options.configure({}, {})
def test_configure_with_dict(): options.configure({'namespace':'foobar'}) assert options.CONFIG['namespace'] == 'foobar'
def test_configure_with_dict(): options.configure({'namespace': 'foobar'}) assert options.CONFIG['namespace'] == 'foobar'