Skip to content

Commit

Permalink
tests/ports/unix: Add coverage test for frozen functions and generators.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Feb 16, 2024
1 parent a3a73b6 commit 5a3dd8c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ports/unix/variants/coverage/frzmpy/frzmpy4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Test importing frozen functions.

# A simple bytecode function with no children.
def f():
return 1


print(__name__, f())


# A simple bytecode generator with no children.
def g():
yield 2


print(__name__, next(g()))
3 changes: 3 additions & 0 deletions tests/ports/unix/extra_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
# test importing various objects
import frzmpy3

# test importing other things
import frzmpy4

# test for MP_QSTR_NULL regression
from frzqstr import returns_NULL

Expand Down
2 changes: 2 additions & 0 deletions tests/ports/unix/extra_coverage.py.exp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ ZeroDivisionError
X
'\x1b'
b'\x00\xff'
frzmpy4 1
frzmpy4 2
NULL
uPy
a long string that is not interned
Expand Down

0 comments on commit 5a3dd8c

Please sign in to comment.