-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial tests for exports and run them in mypy and pyright (#1135)
- Loading branch information
1 parent
8607f1e
commit e22152c
Showing
17 changed files
with
151 additions
and
22 deletions.
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 | ||
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