def test_get_field_simple(): ref = FieldRef('foo') data = { 'foo': 'bar', } value = get_formatted_field(ref, data) assert value == 'bar'
def test_get_field_none(): ref = FieldRef('foo') data = { 'foo': None, } value = get_formatted_field(ref, data) assert value == '<not set>'
def test_field_ref_defaults(): ref = FieldRef('foo') assert ref.name == 'foo' assert ref.type is None assert ref.params is None
def test_field_ref(): ref = FieldRef('foo', 'bar', 'baz') assert ref.name == 'foo' assert ref.type == 'bar' assert ref.params == 'baz'