Esempio n. 1
0
def test_not_field():
    field = NotField(a)
    assert set(field.iter_all_fields()) == set([a])

    field = NotField(Var({
        'a': a,
        'b': b,
        'c': None,  # probably should raise?
    }))
    assert set(field.iter_all_fields()) == set([a, b])
Esempio n. 2
0
def test_not_field():
    field = NotField(a)
    assert set(field.iter_all_fields()) == set([a])
    assert set(field.iter_fields('some_role')) == set([a])

    field = NotField(Var({
        'role_1': a,
        'role_2': b,
        'role_3': None,  # probably should raise?
    }))
    assert set(field.iter_all_fields()) == set([a, b])
    assert set(field.iter_fields('role_1')) == set([a])
    assert set(field.iter_fields('role_3')) == set([])
Esempio n. 3
0
def test_not_field():
    field = NotField(a)
    assert set(field.iter_all_fields()) == set([a])

    field = NotField(
        Var({
            'a': a,
            'b': b,
            'c': None,  # probably should raise?
        }))
    assert set(field.iter_all_fields()) == set([a, b])
Esempio n. 4
0
def test_not_field():
    field = NotField(a)
    assert set(field.iter_fields()) == set([a])
    assert set(field.resolve_and_iter_fields('some_role')) == set([a])

    field = NotField(Var({
        'role_1': a,
        'role_2': b,
        'role_3': None,  # probably should raise?
    }))
    assert set(field.iter_fields()) == set([a, b])
    assert set(field.resolve_and_iter_fields('role_1')) == set([a])
    assert set(field.resolve_and_iter_fields('role_3')) == set([])
Esempio n. 5
0
def test_not_field():
    s_f = StringField()
    field = NotField(Var({'role_1': s_f}))
    assert field.get_schema() == {'not': {}}
    assert field.get_schema(role='role_1') == {'not': s_f.get_schema()}
Esempio n. 6
0
def test_not_field():
    s_f = StringField()
    field = NotField(Var({'role_1': s_f}))
    assert field.get_schema() == {'not': {}}
    assert field.get_schema(role='role_1') == {'not': s_f.get_schema()}