Skip to content

Commit 6d66480

Browse files
refactor: extract duplicated sorting key lambda to improve readability
Addresses PR comment about duplicated lambda function and long line. Extracts the sorting key logic into a reusable variable to eliminate duplication and improve code readability while maintaining the same order-agnostic comparison functionality. Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent 092b4a4 commit 6d66480

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

unit_tests/sources/declarative/test_concurrent_declarative_source.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3885,12 +3885,8 @@ def test_read_concurrent_declarative_source(
38853885
output_data = [
38863886
message.record.data for message in _run_read(manifest, _stream_name) if message.record
38873887
]
3888-
assert sorted(
3889-
output_data, key=lambda x: (x.get("partition", 0), x.get("ABC", 0), x.get("AED", 0))
3890-
) == sorted(
3891-
expected_records,
3892-
key=lambda x: (x.get("partition", 0), x.get("ABC", 0), x.get("AED", 0)),
3893-
)
3888+
sort_key = lambda x: (x.get("partition", 0), x.get("ABC", 0), x.get("AED", 0))
3889+
assert sorted(output_data, key=sort_key) == sorted(expected_records, key=sort_key)
38943890
mock_retriever.assert_has_calls(expected_calls)
38953891

38963892

0 commit comments

Comments
 (0)