mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
1e77f369a2
commit
700c3d7427
@ -68,10 +68,10 @@ else:
|
|||||||
|
|
||||||
if cmd is not None:
|
if cmd is not None:
|
||||||
res = subprocess.run([cmd], encoding='utf-8', input=r'''
|
res = subprocess.run([cmd], encoding='utf-8', input=r'''
|
||||||
def add(a, b):
|
def add(a, b):
|
||||||
return a + b
|
return a + b
|
||||||
|
|
||||||
class A:
|
class A:
|
||||||
def __init__(self, x):
|
def __init__(self, x):
|
||||||
self.x = x
|
self.x = x
|
||||||
|
|
||||||
@ -79,9 +79,12 @@ else:
|
|||||||
return self.x
|
return self.x
|
||||||
|
|
||||||
|
|
||||||
print(add(1, 2))
|
print('ans_1:', add(1, 2))
|
||||||
print(A('abc').get())''', capture_output=True, check=True)
|
print('ans_2:', A('abc').get())
|
||||||
|
exit()
|
||||||
|
''', capture_output=True, check=True)
|
||||||
res.check_returncode()
|
res.check_returncode()
|
||||||
assert res.stdout.endswith('>>> 3\n>>> abc\n>>> '), res.stdout
|
assert 'ans_1: 3' in res.stdout
|
||||||
|
assert 'ans_2: abc' in res.stdout
|
||||||
|
|
||||||
print("ALL TESTS PASSED")
|
print("ALL TESTS PASSED")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user