columns.StringColumn(name='foreign_identifier', required=False, size=3000, truncate=False), columns.URLColumn(name='foreign_landing_url', required=True, size=1000), columns.URLColumn( # `url` in DB name='image_url', required=True, size=3000), columns.URLColumn( # `thumbnail` in DB name='thumbnail_url', required=False, size=3000), columns.IntegerColumn(name='width', required=False), columns.IntegerColumn(name='height', required=False), columns.IntegerColumn(name='filesize', required=False), columns.StringColumn(name='license_', required=True, size=50, truncate=False), 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),
def test_IntegerColumn_prepare_string_leaves_int_strings(): ic = columns.IntegerColumn('test', False) actual_int = ic.prepare_string('5') expect_int = '5' assert actual_int == expect_int
def test_IntegerColumn_prepare_string_casts_ints(): ic = columns.IntegerColumn('test', False) actual_int = ic.prepare_string(4) expect_int = '4' assert actual_int == expect_int
def test_IntegerColumn_prepare_string_casts_and_truncates_float_strings(): ic = columns.IntegerColumn('test', False) actual_int = ic.prepare_string('3.45') expect_int = '3' assert actual_int == expect_int
def test_IntegerColumn_prepare_string_truncates_floats(): ic = columns.IntegerColumn('test', False) actual_int = ic.prepare_string(2.34) expect_int = '2' assert actual_int == expect_int
def test_IntegerColumn_prepare_string_nones_non_number_strings(): ic = columns.IntegerColumn('test', False) actual_int = ic.prepare_string('abc123') expect_int = None assert actual_int == expect_int