-
Notifications
You must be signed in to change notification settings - Fork 433
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
Add initial tests for exports and run them in mypy and pyright #1135
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9207026
Add export tests
pakrym-stripe d0095c0
[LLM] Git diff shows added support for running mypy check in CI/CD pi…
pakrym-stripe 7e3d26d
[LLM] Replace 'type: ignore' comments with 'pyright: ignore' and wrap…
pakrym-stripe 6ccbf53
[LLM] Git diff shows that the Iterator type annotation in the `__iter…
pakrym-stripe ef4465b
[LLM] Add warn_unused_ignores = true to pyproject.toml
pakrym-stripe 54f4b87
[LLM] Refactored ignore directives for pyright in list_object.py, mul…
pakrym-stripe 2544739
more
pakrym-stripe b9c3a52
more tests
pakrym-stripe b8a086e
[LLM] Add extra whitespace and modify import formatting in tests/test…
pakrym-stripe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ virtualenv<20.22.0 | |
pyright == 1.1.336 | ||
black == 22.8.0 | ||
flake8 | ||
mypy == 1.7.0 | ||
|
||
-r test-requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# pyright: strict | ||
pakrym-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import stripe | ||
|
||
|
||
def test_can_import_stripe_object() -> None: | ||
from stripe.stripe_object import ( | ||
StripeObject as StripeObjectFromStripeStripeObject, | ||
) | ||
|
||
assert ( | ||
stripe.stripe_object.StripeObject is StripeObjectFromStripeStripeObject | ||
) | ||
|
||
|
||
def test_can_import_webhook_members() -> None: | ||
from stripe import ( | ||
Webhook, | ||
WebhookSignature, | ||
) | ||
|
||
assert Webhook is not None | ||
assert WebhookSignature is not None | ||
|
||
|
||
def test_can_import_abstract() -> None: | ||
from stripe.api_resources.abstract import ( | ||
APIResource as APIResourceFromApiResourcesAbstract, | ||
) | ||
from stripe.stripe_object import ( | ||
StripeObject, | ||
) | ||
|
||
assert ( | ||
APIResourceFromApiResourcesAbstract[StripeObject] | ||
== stripe.abstract.APIResource[StripeObject] | ||
) | ||
|
||
|
||
def test_can_import_app_info() -> None: | ||
from stripe.app_info import AppInfo as AppInfoFromStripeAppInfo | ||
from stripe import AppInfo as AppInfoFromStripe | ||
|
||
assert AppInfoFromStripeAppInfo is AppInfoFromStripe | ||
assert AppInfoFromStripeAppInfo is stripe.AppInfo | ||
|
||
|
||
def test_can_import_stripe_response() -> None: | ||
from stripe.stripe_response import ( | ||
StripeResponse as StripeResponseFromStripeResponse, | ||
) | ||
|
||
assert ( | ||
StripeResponseFromStripeResponse | ||
is stripe.stripe_response.StripeResponse | ||
) | ||
|
||
|
||
def test_can_import_oauth_members() -> None: | ||
from stripe import ( | ||
OAuth, | ||
) | ||
|
||
assert OAuth is not None | ||
|
||
|
||
def test_can_import_errors() -> None: | ||
from stripe.error import ( | ||
StripeError as StripeErrorFromStripeError, | ||
) | ||
|
||
assert StripeErrorFromStripeError is not None | ||
|
||
|
||
def test_can_import_top_level_resource() -> None: | ||
from stripe import Account as AccountFromStripe | ||
from stripe.api_resources import Account as AccountFromStripeResources | ||
from stripe.api_resources.account import ( | ||
Account as AccountFromStripeResourcesAccount, | ||
) | ||
|
||
assert stripe.Account == AccountFromStripe | ||
assert AccountFromStripe == AccountFromStripeResources | ||
assert AccountFromStripeResourcesAccount == AccountFromStripeResources | ||
|
||
|
||
def test_can_import_namespaced_resource() -> None: | ||
from stripe import tax as TaxPackage | ||
from stripe.api_resources.tax import ( | ||
Calculation as CalculationFromResources, | ||
) | ||
from stripe.api_resources.tax.calculation import ( | ||
Calculation as CalculationFromResourcesCalculation, | ||
) | ||
|
||
assert stripe.tax is TaxPackage | ||
assert stripe.tax.Calculation is TaxPackage.Calculation | ||
assert stripe.tax.Calculation is CalculationFromResources | ||
assert CalculationFromResources is CalculationFromResourcesCalculation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to use #type: ignore in import tests for negative cases.