def test_meta_to_arrow_type(meta_type, arrow_type): assert_meta_col_conversion(ArrowConverter, meta_type, arrow_type, expect_raises=None) # Test round trip ac = ArrowConverter() round_trip_meta_type = ac.reverse_convert_col_type(arrow_type) # reverse always returns non-underscored aliases for bool and list meta_type = meta_type.replace("bool_", "bool") meta_type = meta_type.replace("list_", "list") # utf8 and string are the same # pa.string().equals(pa.utf8()) # True # So reverse conversion sets pa.utf8() to "string" meta_type = meta_type.replace("utf8", "string") # finally remove any whitespace meta_type = "".join(meta_type.split()) round_trip_meta_type = "".join(round_trip_meta_type.split()) assert meta_type == round_trip_meta_type
def test_meta_to_glue_type(meta_type, glue_type, expect_raises): assert_meta_col_conversion(GlueConverter, meta_type, glue_type, expect_raises)
def test_meta_to_etl_manager_type(meta_type, etl_type, expect_raises): assert_meta_col_conversion(EtlManagerConverter, meta_type, etl_type, expect_raises)
def test_etl_manager_to_meta_type(etl_type, meta_type, expect_raises): assert_meta_col_conversion( EtlManagerConverter, etl_type, meta_type, expect_raises, reverse=True )
def test_assert_meta_to_new_type_conversion_edge_cases(): with pytest.raises(Failed, match="DID NOT WARN."): assert_meta_col_conversion(DummyConverter, "test", "TEST", "warning") with pytest.raises(Failed, match="DID NOT RAISE"): assert_meta_col_conversion(DummyConverter, "test", "TEST", "error")
def test_assert_meta_to_new_type_conversion(meta_type, new_type, expect_raises): assert_meta_col_conversion(DummyConverter, meta_type, new_type, expect_raises)
def test_meta_to_arrow_type(meta_type, arrow_type): assert_meta_col_conversion(ArrowConverter, meta_type, arrow_type, expect_raises=None)