Skip to content

Commit ec9e480

Browse files
author
octavia-squidington-iii
committed
Auto-fix lint and format issues
1 parent fb21cd4 commit ec9e480

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

airbyte_cdk/sources/declarative/resolvers/http_components_resolver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ def resolve_components(
8989
kwargs = {"stream_template_config": stream_template_config}
9090

9191
for stream_slice in self.retriever.stream_slices():
92-
for components_values in self.retriever.read_records(records_schema={}, stream_slice=stream_slice):
92+
for components_values in self.retriever.read_records(
93+
records_schema={}, stream_slice=stream_slice
94+
):
9395
updated_config = deepcopy(stream_template_config)
9496
kwargs["components_values"] = components_values # type: ignore[assignment] # component_values will always be of type Mapping[str, Any]
9597
kwargs["stream_slice"] = stream_slice # type: ignore[assignment] # stream_slice will always be of type Mapping[str, Any]

unit_tests/sources/declarative/resolvers/test_http_components_resolver.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -284,23 +284,24 @@
284284
},
285285
"record_selector": {
286286
"type": "RecordSelector",
287-
"extractor": {"type": "DpathExtractor", "field_path": []},
287+
"extractor": {
288+
"type": "DpathExtractor",
289+
"field_path": [],
290+
},
288291
},
289292
},
290293
"schema_loader": {
291294
"type": "InlineSchemaLoader",
292295
"schema": {
293296
"$schema": "http://json-schema.org/schema#",
294-
"properties": {
295-
"id": {"type": "integer"}
296-
},
297+
"properties": {"id": {"type": "integer"}},
297298
"type": "object",
298299
},
299300
},
300-
}
301+
},
301302
}
302-
]
303-
}
303+
],
304+
},
304305
},
305306
"components_mapping": [
306307
{
@@ -322,6 +323,8 @@
322323
}
323324
],
324325
}
326+
327+
325328
@pytest.mark.parametrize(
326329
"components_mapping, retriever_data, stream_template_config, expected_result",
327330
[
@@ -358,6 +361,7 @@ def test_http_components_resolver(
358361
result = list(resolver.resolve_components(stream_template_config=stream_template_config))
359362
assert result == expected_result
360363

364+
361365
@pytest.mark.parametrize(
362366
"components_mapping, retriever_data, stream_template_config, expected_result",
363367
[
@@ -394,6 +398,7 @@ def test_http_components_resolver_with_stream_slices(
394398
result = list(resolver.resolve_components(stream_template_config=stream_template_config))
395399
assert result == expected_result
396400

401+
397402
def test_dynamic_streams_read_with_http_components_resolver():
398403
expected_stream_names = ["item_1", "item_2"]
399404
with HttpMocker() as http_mocker:
@@ -466,16 +471,18 @@ def test_duplicated_dynamic_streams_read_with_http_components_resolver():
466471
== "Dynamic streams list contains a duplicate name: item_2. Please contact Airbyte Support."
467472
)
468473

474+
469475
def test_dynamic_streams_with_http_components_resolver_retriever_with_parent_stream():
470476
expected_stream_names = [
471-
"parent_1_item_1", "parent_1_item_2", "parent_2_item_1", "parent_2_item_2"
477+
"parent_1_item_1",
478+
"parent_1_item_2",
479+
"parent_2_item_1",
480+
"parent_2_item_2",
472481
]
473482
with HttpMocker() as http_mocker:
474483
http_mocker.get(
475484
HttpRequest(url="https://api.test.com/parents"),
476-
HttpResponse(
477-
body=json.dumps([{"id": 1}, {"id": 2}])
478-
),
485+
HttpResponse(body=json.dumps([{"id": 1}, {"id": 2}])),
479486
)
480487
parent_ids = [1, 2]
481488
for parent_id in parent_ids:
@@ -494,13 +501,14 @@ def test_dynamic_streams_with_http_components_resolver_retriever_with_parent_str
494501
for dynamic_stream_path in dynamic_stream_paths:
495502
http_mocker.get(
496503
HttpRequest(url=f"https://api.test.com/{dynamic_stream_path}"),
497-
HttpResponse(
498-
body=json.dumps([{"ABC": 1, "AED": 2}])
499-
),
504+
HttpResponse(body=json.dumps([{"ABC": 1, "AED": 2}])),
500505
)
501506

502507
source = ConcurrentDeclarativeSource(
503-
source_config=_MANIFEST_WITH_HTTP_COMPONENT_RESOLVER_WITH_RETRIEVER_WITH_PARENT_STREAM, config=_CONFIG, catalog=None, state=None
508+
source_config=_MANIFEST_WITH_HTTP_COMPONENT_RESOLVER_WITH_RETRIEVER_WITH_PARENT_STREAM,
509+
config=_CONFIG,
510+
catalog=None,
511+
state=None,
504512
)
505513

506514
actual_catalog = source.discover(logger=source.logger, config=_CONFIG)
@@ -520,4 +528,4 @@ def test_dynamic_streams_with_http_components_resolver_retriever_with_parent_str
520528
assert len(actual_catalog.streams) == 4
521529
assert [stream.name for stream in actual_catalog.streams] == expected_stream_names
522530
assert len(records) == 4
523-
assert [record.stream for record in records] == expected_stream_names
531+
assert [record.stream for record in records] == expected_stream_names

0 commit comments

Comments
 (0)