Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1660: Fix ExcelControl copying of stringified attribute #1661

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

richardt-engineb
Copy link

@richardt-engineb richardt-engineb commented Jun 13, 2024

Description

As described in #1660, the stringified attribute is not copied during the to_copy() as it is not included in the metadata_profile_patch.

This commit fixes it by adding it to the metadata_profile_patch and updates the documentation to clarify the interaction of stringified and schemas. This also inclues a unit test to verify the bug fix.

Tests

Ensure the new unit test detects the issue before the fix:

> pytest frictionless/formats/excel/__spec__/test_control.py::test_excel_control_to_copy

[...]

>       assert control_copy == control_with_changed_attributes
E       AssertionError: assert {'type': 'exc...tError': True} == {'type': 'exc...tError': True}
E
E         Omitting 8 identical items, use -vv to show
E         Differing attributes:
E         ['stringified']
E
E         Drill down into differing attribute stringified:
E           stringified: False != True

frictionless/formats/excel/__spec__/test_control.py:25: AssertionError

Ensure the unit test runs and passes after the fix:

> pytest frictionless/formats/excel/__spec__/test_control.py::test_excel_control_to_copy -v

[...]

frictionless/formats/excel/__spec__/test_control.py::test_excel_control_to_copy PASSED [100%]

# Description

As described in frictionlessdata#1660, the `stringified` attribute is not copied during the `to_copy()` as it is not included in the `metadata_profile_patch`.

This commit fixes it by adding it to the `metadata_profile_patch`.  This also inclues a unit test to verify the change.

# Tests

Ensure the new unit test detects the issue before the fix:

```
> pytest frictionless/formats/excel/__spec__/test_control.py::test_excel_control_to_copy

[...]

>       assert control_copy == control_with_changed_attributes
E       AssertionError: assert {'type': 'exc...tError': True} == {'type': 'exc...tError': True}
E
E         Omitting 8 identical items, use -vv to show
E         Differing attributes:
E         ['stringified']
E
E         Drill down into differing attribute stringified:
E           stringified: False != True

frictionless/formats/excel/__spec__/test_control.py:25: AssertionError
```

Ensure the unit test runs and passes after the fix:

```
> pytest frictionless/formats/excel/__spec__/test_control.py::test_excel_control_to_copy -v

[...]

frictionless/formats/excel/__spec__/test_control.py::test_excel_control_to_copy PASSED [100%]
```
…action with schema

- fixes ExcelControl(stringified=True) documentation could clarify interaction with schemas frictionlessdata#1659
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant