Skip to content

Commit d68b833

Browse files
Update run-loops.test
1 parent 5237f0b commit d68b833

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

mypyc/test-data/run-loops.test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,36 @@ print(f([0, 1, 2, 3, 4, 5, 6]))
604604
[out]
605605
6
606606

607+
[case testRunForFilterNative]
608+
def f(x: int) -> int:
609+
return x % 2
610+
def g(a: list[int]) -> int:
611+
c = 0
612+
for x in filter(f, a):
613+
c += 1
614+
return c
615+
616+
[file driver.py]
617+
from native import g
618+
print(g([0, 1, 2, 3, 4, 5, 6]))
619+
620+
[out]
621+
3
622+
623+
[case testRunForFilterPrimitiveOp]
624+
def f(a: list[list[int]]) -> int:
625+
c = 0
626+
for x in filter(len, a):
627+
c += 1
628+
return c
629+
630+
[file driver.py]
631+
from native import f
632+
print(f([[], [0, 1], [], [], [2, 3, 4], [5, 6]]))
633+
634+
[out]
635+
3
636+
607637
[case testRunForFilterEdgeCases]
608638
def f(a: list[int]) -> int:
609639
s = 0

0 commit comments

Comments
 (0)