예제 #1
0
    def test_get_column_type_contains_map(self):

        field_type = "map_hehe"
        data_type = get_column_type(self.glue_source, field_type, "a_table", "a_field")
        self.assertEqual(
            data_type.to_obj(), SchemaFieldDataType(type=MapTypeClass()).to_obj()
        )
예제 #2
0
    def test_get_column_type_contains_set(self):

        field_type = "set_yolo"
        data_type = get_column_type(self.glue_source, field_type, "a_table", "a_field")
        self.assertEqual(
            data_type.to_obj(), SchemaFieldDataType(type=ArrayTypeClass()).to_obj()
        )
예제 #3
0
    def test_get_column_type_contains_key(self):

        field_type = "char"
        data_type = get_column_type(self.glue_source, field_type, "a_table", "a_field")
        self.assertEqual(
            data_type.to_obj(), SchemaFieldDataType(type=StringTypeClass()).to_obj()
        )
예제 #4
0
def test_get_column_type_contains_set():

    field_type = "set_yolo"
    data_type = get_column_type(glue_source(), field_type, "a_table",
                                "a_field")
    assert data_type.to_obj() == SchemaFieldDataType(
        type=ArrayTypeClass()).to_obj()
예제 #5
0
def test_get_column_type_contains_map():

    field_type = "map_hehe"
    data_type = get_column_type(glue_source(), field_type, "a_table",
                                "a_field")
    assert data_type.to_obj() == SchemaFieldDataType(
        type=MapTypeClass()).to_obj()
예제 #6
0
def test_get_column_type_contains_key():

    field_type = "char"
    data_type = get_column_type(glue_source(), field_type, "a_table",
                                "a_field")
    assert data_type.to_obj() == SchemaFieldDataType(
        type=StringTypeClass()).to_obj()
예제 #7
0
def test_get_column_type_not_contained():

    glue_source_instance = glue_source()

    field_type = "bad_column_type"
    data_type = get_column_type(glue_source_instance, field_type, "a_table", "a_field")
    assert data_type.to_obj() == SchemaFieldDataType(type=StringTypeClass()).to_obj()
    assert glue_source_instance.report.warnings["bad_column_type"] == [
        "The type 'bad_column_type' is not recognised for field 'a_field' in table 'a_table', "
        "setting as StringTypeClass."
    ]
예제 #8
0
    def test_get_column_type_not_contained(self):

        field_type = "bad_column_type"
        data_type = get_column_type(self.glue_source, field_type, "a_table", "a_field")
        self.assertEqual(
            data_type.to_obj(), SchemaFieldDataType(type=StringTypeClass()).to_obj()
        )
        self.assertEqual(
            self.glue_source.report.warnings["bad_column_type"],
            [
                "The type 'bad_column_type' is not recognised for field 'a_field' in table 'a_table', "
                "setting as StringTypeClass."
            ],
        )