Beispiel #1
0
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()
Beispiel #2
0
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()
Beispiel #3
0
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()
Beispiel #4
0
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()
Beispiel #5
0
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()
Beispiel #6
0
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()
Beispiel #7
0
def test_options_update():
    options.configure(namespace='foobar')
    assert options.CONFIG['namespace'] == 'foobar'
Beispiel #8
0
def test_stupid_option():
    options.configure(foobar=True)
Beispiel #9
0
def test_wrong_arg():
    options.configure(1)
Beispiel #10
0
def test_too_many_args():
    options.configure({}, {})
Beispiel #11
0
def test_configure_with_dict():
    options.configure({'namespace':'foobar'})
    assert options.CONFIG['namespace'] == 'foobar'
Beispiel #12
0
def test_options_update():
    options.configure(namespace='foobar')
    assert options.CONFIG['namespace'] == 'foobar'
Beispiel #13
0
def test_stupid_option():
    options.configure(foobar=True)
Beispiel #14
0
def test_wrong_arg():
    options.configure(1)
Beispiel #15
0
def test_too_many_args():
    options.configure({}, {})
Beispiel #16
0
def test_configure_with_dict():
    options.configure({'namespace': 'foobar'})
    assert options.CONFIG['namespace'] == 'foobar'