columns.StringColumn(name='license_version', required=True, size=25, truncate=False), columns.StringColumn(name='creator', required=False, size=2000, truncate=True), columns.URLColumn(name='creator_url', required=False, size=2000), columns.StringColumn(name='title', required=False, size=5000, truncate=True), columns.JSONColumn(name='meta_data', required=False), columns.JSONColumn(name='tags', required=False), columns.BooleanColumn(name='watermarked', required=False), columns.StringColumn(name='provider', required=False, size=80, truncate=False), columns.StringColumn(name='source', required=False, size=80, truncate=False) ] Image = namedtuple('Image', [c.NAME for c in _IMAGE_TSV_COLUMNS]) # Filter out tags that exactly match these terms. All terms should be # lowercase. TAG_BLACKLIST = {'no person', 'squareformat'}
def test_BooleanColumn_prepare_string_casts_falselike(): bc = columns.BooleanColumn('test', False) falselike_values = [False, 'false', 'False', 'f', 'F'] assert all([bc.prepare_string(v) == 'f' for v in falselike_values])
def test_BooleanColumn_prepare_string_leaves_f(): bc = columns.BooleanColumn('test', False) actual_bool = bc.prepare_string('f') expect_bool = 'f' assert actual_bool == expect_bool
def test_BooleanColumn_prepare_string_casts_truthlike(): bc = columns.BooleanColumn('test', False) truthlike_values = [True, 'true', 'True', 't', 'T'] assert all([bc.prepare_string(v) == 't' for v in truthlike_values])
def test_BooleanColumn_prepare_string_falls_back_to_none(): bc = columns.BooleanColumn('test', False) actual_bool = bc.prepare_string('g') expect_bool = None assert actual_bool == expect_bool