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_parse_type(): ref = FieldRef.from_str('foo:bar:baz') assert ref.name == 'foo' assert ref.type == 'bar' assert ref.params == 'baz'
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_parse_simple(): ref = FieldRef.from_str('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'
def test_get_formatted_field(select, expect): field = FieldRef.from_str(select) assert get_formatted_field(field, response_data) == expect