Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dagostinol committed Jul 12, 2023
1 parent e347f30 commit 962c1c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 39 deletions.
2 changes: 1 addition & 1 deletion target_s3_parquet/data_type_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def coerce_types(name, type, format=None, description=None):
if format == "date-time":
return "timestamp"

if description in ["raw","blob"]:
if description in ["raw", "blob"]:
return "binary"

return type
Expand Down
48 changes: 10 additions & 38 deletions target_s3_parquet/tests/test_data_type_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_schema_with_all_of():
{"type": "string", "format": "date-time"},
{"type": ["string", "null"]},
]
},
}
}

assert generate_tap_schema(schema) == {"lastModifiedDate": "string"}
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_complex_schema():
"identity_profiles": "array<struct<deleted_changed_timestamp:timestamp, "
+ "saved_at_timestamp:timestamp, vid:int, "
+ "identities:array<struct<timestamp:timestamp, type:string, "
+ "value:string>>>>",
+ "value:string>>>>"
}

assert generate_tap_schema(schema) == expected_result
Expand All @@ -103,11 +103,7 @@ def test_number_type():
"type": ["null", "array"],
"items": {
"type": ["null", "object"],
"properties": {
"some_value": {
"type": ["null", "number"],
},
},
"properties": {"some_value": {"type": ["null", "number"]}},
},
},
}
Expand All @@ -128,11 +124,7 @@ def test_integer_type():
"type": ["null", "array"],
"items": {
"type": ["null", "object"],
"properties": {
"some_value": {
"type": ["null", "integer"],
},
},
"properties": {"some_value": {"type": ["null", "integer"]}},
},
},
}
Expand Down Expand Up @@ -173,11 +165,7 @@ def test_only_string_definition():
"type": ["null", "array"],
"items": {
"type": ["null", "object"],
"properties": {
"some_value": {
"type": ["null", "integer"],
},
},
"properties": {"some_value": {"type": ["null", "integer"]}},
},
},
}
Expand All @@ -190,33 +178,17 @@ def test_only_string_definition():

def test_binary_type():
schema = {
"image": {
"type": ["null", "string"],
"description": "blob"
},
"free_text": {
"type": ["null", "string"],
"description": "raw"
}
"image": {"type": ["null", "string"], "description": "blob"},
"free_text": {"type": ["null", "string"], "description": "raw"},
}

assert generate_tap_schema(schema) == {
"image": "binary",
"free_text": "binary"
}
assert generate_tap_schema(schema) == {"image": "binary", "free_text": "binary"}


def test_singer_decimal_type():
schema = {
"measurement": {
"type": ["null", "string"],
"format": "singer.decimal"
}
}
schema = {"measurement": {"type": ["null", "string"], "format": "singer.decimal"}}

assert generate_tap_schema(schema) == {
"measurement": "double"
}
assert generate_tap_schema(schema) == {"measurement": "double"}


def test_get_current_schema():
Expand Down

0 comments on commit 962c1c4

Please sign in to comment.