Пример #1
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()
        )
Пример #2
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()
Пример #3
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."
    ]
Пример #4
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."
            ],
        )