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

Merged

Conversation

richardt-engineb
Copy link
Contributor

@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
Copy link
Collaborator

@pierrecamilleri pierrecamilleri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request.

@pierrecamilleri
Copy link
Collaborator

I am not sure why the CI checks were not performed. @richardt-engineb, would you mind pushing an empty commit to see if it triggers the CI ?

Trivial comment update to hopefully trigger the CI.
@richardt-engineb
Copy link
Contributor Author

richardt-engineb commented Sep 6, 2024

Trivial comment update commit added. Hopefully this will trigger it!

Also might need approval from a maintainer as I'm a first time contributor from a public fork.

@pierrecamilleri pierrecamilleri merged commit aee8c65 into frictionlessdata:main Sep 6, 2024
9 checks passed
@pierrecamilleri
Copy link
Collaborator

It worked :) Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants