-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Resolve #16, remove the dependency to "PyO3/experimental-inspect" - New `TypeInfo` is introduced which replace `pyo3::inspect::types::TypeInfo`. It is generated by `PyStubType` traits. - Impelement `PyStubType` to - builtins (`u32`, `i32`, `String`, ...) - Collections (`Vec<T>`, `HashMap<K, V>`, ...) - PyO3 primitives (`PyAny`, `PyList`, `PyDict`) - Helper for implementing `PyStubType` for user struct, i.e. `#[derive(PyStubType)]` will be next PR.
- Loading branch information
Showing
29 changed files
with
471 additions
and
102 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
2 changes: 0 additions & 2 deletions
2
pyo3-stub-gen-testing-mixed/python/pyo3_stub_gen_testing_mixed/my_rust_pkg.pyi
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 |
---|---|---|
@@ -1,5 +1,31 @@ | ||
import pyo3_stub_gen_testing_pure | ||
from pyo3_stub_gen_testing_pure import sum, create_dict, read_dict | ||
import pytest | ||
|
||
|
||
def test_sum_as_string(): | ||
assert pyo3_stub_gen_testing_pure.sum_as_string(1, 2) == "3" | ||
def test_sum(): | ||
assert sum([1, 2]) == 3 | ||
assert sum((1, 2)) == 3 | ||
|
||
|
||
def test_create_dict(): | ||
assert create_dict(3) == {0: [], 1: [0], 2: [0, 1]} | ||
|
||
|
||
def test_read_dict(): | ||
read_dict( | ||
{ | ||
0: { | ||
0: 1, | ||
}, | ||
1: { | ||
0: 2, | ||
1: 3, | ||
}, | ||
} | ||
) | ||
|
||
with pytest.raises(TypeError) as e: | ||
read_dict({0: 1}) # type: ignore | ||
assert ( | ||
str(e.value) == "argument 'dict': 'int' object cannot be converted to 'PyDict'" | ||
) |
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.