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

Drop private imports from test_urlparse.py #2572

Merged
merged 4 commits into from Feb 15, 2023

Conversation

florimondmanca
Copy link
Member

@florimondmanca florimondmanca commented Feb 5, 2023

More towards #2492

We still access ._uri_reference, because the goal of this module is to test our vendored urlparse() implementation, but at least we do so from httpx.URL().

@florimondmanca florimondmanca added the refactor Issues and PRs related to code refactoring label Feb 5, 2023
"host",
"port",
):
raise TypeError(f"'{key}' is an invalid keyword argument for urlparse()")
Copy link
Member Author

Choose a reason for hiding this comment

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

We were already doing this check in URL.__init__(), so in the wild it would indeed be redundant as we use httpx.URL(), so I dropped this check.

Copy link
Member

@tomchristie tomchristie left a comment

Choose a reason for hiding this comment

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

Can we drop the ._uri_reference access on these cases, and instead inspect the public properties on the URL instance?

For example...

url = httpx.URL("https://example.com/")
assert url.host == "example.com"

@tomchristie tomchristie merged commit a934c36 into master Feb 15, 2023
@tomchristie tomchristie deleted the refactor/urlparse-private-imports branch February 15, 2023 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Issues and PRs related to code refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants