Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 9, 2023
1 parent e662dd9 commit 3098a9e
Showing 1 changed file with 44 additions and 16 deletions.
60 changes: 44 additions & 16 deletions tests/core/test_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
from singer_sdk.tap_base import Tap
from singer_sdk.typing import (
ArrayType,
BooleanType,
IntegerType,
NumberType,
ObjectType,
OneOf,
PropertiesList,
Property,
StringType,
BooleanType,
OneOf,
)

if t.TYPE_CHECKING:
Expand Down Expand Up @@ -60,11 +60,15 @@ def sample_catalog_dict() -> dict:
).to_dict()
nested_jellybean_schema = PropertiesList(
Property("id", IntegerType),
Property("custom_fields",
ArrayType(ObjectType(
Property("id", IntegerType),
Property("value", OneOf(StringType, IntegerType, BooleanType))))
)
Property(
"custom_fields",
ArrayType(
ObjectType(
Property("id", IntegerType),
Property("value", OneOf(StringType, IntegerType, BooleanType)),
)
),
),
).to_dict()
return {
"streams": [
Expand All @@ -81,8 +85,8 @@ def sample_catalog_dict() -> dict:
{
"stream": "nested_jellybean",
"tap_stream_id": "nested_jellybean",
"schema": nested_jellybean_schema
}
"schema": nested_jellybean_schema,
},
],
}

Expand Down Expand Up @@ -126,8 +130,22 @@ def sample_stream():
{"brown": "fox"},
],
"nested_jellybean": [
{"id": 123, "custom_fields": [{"id": 1, "value": "abc"}, {"id": 2, "value": 1212}, {"id": 3, "value": None}]},
{"id": 124, "custom_fields": [{"id": 1, "value": "foo"}, {"id": 2, "value": 9009}, {"id": 3, "value": True}]}
{
"id": 123,
"custom_fields": [
{"id": 1, "value": "abc"},
{"id": 2, "value": 1212},
{"id": 3, "value": None},
],
},
{
"id": 124,
"custom_fields": [
{"id": 1, "value": "foo"},
{"id": 2, "value": 9009},
{"id": 3, "value": True},
],
},
],
}

Expand All @@ -153,7 +171,7 @@ def transform_stream_maps():
"custom_field_1": 'dict([(x["id"], x["value"]) for x in custom_fields]).get(1)',
"custom_field_2": 'int(dict([(x["id"], x["value"]) for x in custom_fields]).get(2)) if dict([(x["id"], x["value"]) for x in custom_fields]).get(2) else None',
"custom_field_3": 'bool(dict([(x["id"], x["value"]) for x in custom_fields]).get(3)) if dict([(x["id"], x["value"]) for x in custom_fields]).get(3) else None',
}
},
}


Expand Down Expand Up @@ -211,8 +229,18 @@ def transformed_result(stream_map_config):
{"brown": "fox"},
],
"nested_jellybean": [
{"id": 123, "custom_field_1": "abc", "custom_field_2": 1212, "custom_field_3": None},
{"id": 124, "custom_field_1": "foo", "custom_field_2": 9009, "custom_field_3": True}
{
"id": 123,
"custom_field_1": "abc",
"custom_field_2": 1212,
"custom_field_3": None,
},
{
"id": 124,
"custom_field_1": "foo",
"custom_field_2": 9009,
"custom_field_3": True,
},
],
}

Expand All @@ -237,8 +265,8 @@ def transformed_schemas():
Property("id", IntegerType),
Property("custom_field_1", StringType),
Property("custom_field_2", IntegerType),
Property("custom_field_3", BooleanType)
).to_dict()
Property("custom_field_3", BooleanType),
).to_dict(),
}


Expand Down

0 comments on commit 3098a9e

Please sign in to comment.