コード例 #1
0
def test_get_field_simple():
    ref = FieldRef('foo')
    data = {
        'foo': 'bar',
    }
    value = get_formatted_field(ref, data)
    assert value == 'bar'
コード例 #2
0
def test_get_field_none():
    ref = FieldRef('foo')
    data = {
        'foo': None,
    }
    value = get_formatted_field(ref, data)
    assert value == '<not set>'
コード例 #3
0
def test_field_ref_defaults():
    ref = FieldRef('foo')
    assert ref.name == 'foo'
    assert ref.type is None
    assert ref.params is None
コード例 #4
0
def test_field_ref():
    ref = FieldRef('foo', 'bar', 'baz')
    assert ref.name == 'foo'
    assert ref.type == 'bar'
    assert ref.params == 'baz'