FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnative/tests/test_codegen.py at v0.41.0 · pythonnative/pythonnative · GitHub
pythonnative
pythonnative
Repository navigation
Code
Issues
11
(11)
Pull requests
4
(4)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnative
/
tests
/
test_codegen.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (23 loc) · 1 KB
Breadcrumbs
pythonnative
/
tests
/
test_codegen.py
Copy path
File metadata and controls
26 lines (23 loc) · 1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Generated native contracts match a clean Python interpreter."""
import
subprocess
import
sys
from
pathlib
import
Path
def
test_checked_native_contracts_match_python_definitions
(
tmp_path
:
Path
)
->
None
:
subprocess
.
run
(
[
sys
.
executable
,
"-c"
,
"import pythonnative; from pythonnative.sdk.codegen import generate; "
"import sys; generate(sys.argv[1])"
,
str
(
tmp_path
),
],
check
=
True
,
)
root
=
Path
(
__file__
).
parents
[
1
]
/
"src/pythonnative/native"
for
extension
,
folder
in
(
(
"swift"
,
root
/
"ios/Sources/PythonNativeKit/Generated"
),
(
"kt"
,
root
/
"android/src/main/java/com/pythonnative/generated"
),
):
for
name
in
(
"PNContracts"
,
"NativeProps"
,
"NativeModules"
):
assert
(
tmp_path
/
f"
{
name
}
.
{
extension
}
"
).
read_bytes
()
==
(
folder
/
f"
{
name
}
.
{
extension
}
"
).
read_bytes
()
for
name
in
(
"components.py"
,
"modules.py"
):
compile
((
tmp_path
/
name
).
read_text
(),
str
(
tmp_path
/
name
),
"exec"
)
Back
|
FazBrowse Home
|
New Git URL