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

rfctr: prepare for adding metadata.orig_elements field #2647

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

scanny
Copy link
Collaborator

@scanny scanny commented Mar 14, 2024

Summary
Some typing modernization in elements.py which will get changes to add the orig_elements metadata field.

Also some additions to unit_util.py to enable simplified mocking that will be required in the next PR.

@@ -31,6 +31,7 @@ select = [
]
ignore = [
"COM812", # -- over aggressively insists on trailing commas where not desireable --
"PT005", # -- flags mock fixtures with names intentionally matching private method name --
"PT011", # -- pytest.raises({exc}) too broad, use match param or more specific exception --
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this change need to be replicated in in .pre-commit-config.yaml and Makefile? (note at the top)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, yeah, good call. I've removed those redundant explicit options definitions. Now they should be picked up from the pyproject.toml so it's the single source of truth on options.

"method_mock",
"property_mock",
)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not that this needs to be changed, but isn't __all__ used to define what's imported when you use * to import, or is there another use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it is, but it also indicates what you are intentionally "exporting" and prevents ruff errors related to "xyz is imported but not used". That's why I have it here.

# ------------------------------------------------------------------------------------------------
# MOCKING FIXTURES
# ------------------------------------------------------------------------------------------------
# These allow full-featured and type-save mocks to be created simply by adding a unit-test
Copy link
Collaborator

Choose a reason for hiding this comment

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

type-save or type-safe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, good catch. Fixed.

Copy link
Collaborator

@Coniferish Coniferish left a comment

Choose a reason for hiding this comment

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

LGTM

scanny added 3 commits March 14, 2024 13:34
Add utility functions that allow robust mocks to be created by adding a
simple unit-test fixture.
@scanny scanny force-pushed the scanny/prep-for-orig-elements branch from ac3295d to b70647d Compare March 14, 2024 20:35
@scanny scanny added this pull request to the merge queue Mar 14, 2024
Merged via the queue into main with commit 94535e3 Mar 14, 2024
46 checks passed
@scanny scanny deleted the scanny/prep-for-orig-elements branch March 14, 2024 22:03
kaaloo pushed a commit to inclusif/unstructured that referenced this pull request Apr 8, 2024
…IO#2647)

**Summary**
Some typing modernization in `elements.py` which will get changes to add
the `orig_elements` metadata field.

Also some additions to `unit_util.py` to enable simplified mocking that
will be required in the next PR.
kaaloo pushed a commit to inclusif/unstructured that referenced this pull request Apr 8, 2024
…IO#2647)

**Summary**
Some typing modernization in `elements.py` which will get changes to add
the `orig_elements` metadata field.

Also some additions to `unit_util.py` to enable simplified mocking that
will be required in the next PR.
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.

2 participants