-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor generating methods/props that are async * Better logic * Codegen + update _classes.py * fix issue, plus add tests * add comment * Add docs * apply codegenn to _api.py * Tweak for prop * Backwards compat * fix codegen test * Fix tests * Replace method usage, and disbale backwards compat * forgot one * fix * format * Logic to disable sync method for portability testing * format and enable backwards compat again * codegen
- Loading branch information
1 parent
bd8dab7
commit 7cd6ab4
Showing
39 changed files
with
567 additions
and
215 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
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,18 @@ | ||
""" Test some aspects of the generated code. | ||
""" | ||
|
||
from codegen.files import read_file | ||
|
||
|
||
def test_async_methods_and_props(): | ||
# Test that only and all aync methods are suffixed with '_async' | ||
|
||
for fname in ["_classes.py", "backends/wgpu_native/_api.py"]: | ||
code = read_file(fname) | ||
for line in code.splitlines(): | ||
line = line.strip() | ||
if line.startswith("def "): | ||
assert not line.endswith("_async"), line | ||
elif line.startswith("async def "): | ||
name = line.split("def", 1)[1].split("(")[0].strip() | ||
assert name.endswith("_async"), line |
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
Oops, something went wrong.