コード例 #1
0
ファイル: test_options.py プロジェクト: shakefu/MongoAlchemy
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()
コード例 #2
0
ファイル: test_options.py プロジェクト: shakefu/MongoAlchemy
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()
コード例 #3
0
ファイル: test_options.py プロジェクト: shakefu/MongoAlchemy
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()
コード例 #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()
コード例 #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()
コード例 #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()
コード例 #7
0
ファイル: test_options.py プロジェクト: shakefu/MongoAlchemy
def test_options_update():
    options.configure(namespace='foobar')
    assert options.CONFIG['namespace'] == 'foobar'
コード例 #8
0
ファイル: test_options.py プロジェクト: shakefu/MongoAlchemy
def test_stupid_option():
    options.configure(foobar=True)
コード例 #9
0
ファイル: test_options.py プロジェクト: shakefu/MongoAlchemy
def test_wrong_arg():
    options.configure(1)
コード例 #10
0
ファイル: test_options.py プロジェクト: shakefu/MongoAlchemy
def test_too_many_args():
    options.configure({}, {})
コード例 #11
0
ファイル: test_options.py プロジェクト: shakefu/MongoAlchemy
def test_configure_with_dict():
    options.configure({'namespace':'foobar'})
    assert options.CONFIG['namespace'] == 'foobar'
コード例 #12
0
def test_options_update():
    options.configure(namespace='foobar')
    assert options.CONFIG['namespace'] == 'foobar'
コード例 #13
0
def test_stupid_option():
    options.configure(foobar=True)
コード例 #14
0
def test_wrong_arg():
    options.configure(1)
コード例 #15
0
def test_too_many_args():
    options.configure({}, {})
コード例 #16
0
def test_configure_with_dict():
    options.configure({'namespace': 'foobar'})
    assert options.CONFIG['namespace'] == 'foobar'