Skip to content

Add regression tests for nullable_nonnegative decode filter in write_tables#1087

Draft
jpn-- with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-code-for-review-comment
Draft

Add regression tests for nullable_nonnegative decode filter in write_tables#1087
jpn-- with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-code-for-review-comment

Conversation

Copilot AI commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

No test coverage existed for decode_columns mappings where the target column contains nulls and/or -1 sentinel values — the scenario addressed by the nullable_nonnegative filter added in this PR.

Changes

  • activitysim/core/steps/_decode.py (new): Extracts _decode_output_column and _apply_decode_filter out of output.py into a pandas/numpy-only module, breaking the circular import chain (output → estimation → simulate → estimation) that prevented unit testing.
  • activitysim/core/steps/output.py: Imports the two helpers from _decode.py; behavior is unchanged.
  • activitysim/core/test/test_output.py (new): 7 focused unit tests covering all decode filter paths and the key regression scenario — a column mixing pd.NA nulls and -1 sentinels with nullable_nonnegative:
column = pd.array([0, pd.NA, -1, 3, pd.NA], dtype="Int64")
map_func, preserve_nulls = _apply_decode_filter(zone_labels, "nullable_nonnegative")
result = _decode_output_column(column, map_func, preserve_nulls=preserve_nulls)
# result: [100, NA, -1, 400, NA]

Copilot AI changed the title [WIP] Fix code based on review comment Add regression tests for nullable_nonnegative decode filter in write_tables Jul 13, 2026
Copilot finished work on behalf of jpn-- July 13, 2026 00:23
Copilot AI requested a review from jpn-- July 13, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants