-
-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[POC] Typing ergonomics and guarantees
- Loading branch information
Showing
9 changed files
with
58 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Toga's API typing is now tested. |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from toga.style.applicator import TogaApplicator # noqa: F401 | ||
from toga.style.pack import Pack # noqa: F401 | ||
from toga.style.pack import Pack as Pack # noqa: F401 |
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
Empty file.
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,24 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
import PIL.Image | ||
from typing_extensions import assert_type | ||
|
||
import toga | ||
|
||
assert_type(toga.Image().size, tuple[int, int]) | ||
|
||
assert_type(toga.Image().width, int) | ||
|
||
assert_type(toga.Image().height, int) | ||
|
||
assert_type(toga.Image().data, bytes) | ||
|
||
assert_type(toga.Image().path, "Path | None") | ||
|
||
assert_type(toga.Image().save(path="/data"), None) | ||
assert_type(toga.Image().save(path=Path("/data")), None) | ||
|
||
assert_type(toga.Image().as_format(toga.Image), toga.Image) | ||
assert_type(toga.Image().as_format(PIL.Image.Image), PIL.Image.Image) |
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