This commit is contained in:
blueloveTH 2024-01-19 14:27:13 +08:00
parent 96c926e4b3
commit 1e77f369a2
5 changed files with 28 additions and 5 deletions

View File

@ -62,7 +62,7 @@ else:
if sys.platform in ['linux', 'darwin']: if sys.platform in ['linux', 'darwin']:
cmd = './main' cmd = './main'
elif sys.platform == 'win32': elif sys.platform == 'win32':
cmd = 'main.exe' cmd = '.\main.exe'
else: else:
cmd = None cmd = None
@ -80,9 +80,8 @@ else:
print(add(1, 2)) print(add(1, 2))
print(A('abc').get()) print(A('abc').get())''', capture_output=True, check=True)
''', capture_output=True, check=True)
res.check_returncode() res.check_returncode()
assert res.stdout.endswith('>>> 3\n>>> abc\n>>> ') assert res.stdout.endswith('>>> 3\n>>> abc\n>>> '), res.stdout
print("ALL TESTS PASSED") print("ALL TESTS PASSED")

View File

@ -115,3 +115,5 @@ try:
exit(1) exit(1)
except ZeroDivisionError: except ZeroDivisionError:
pass pass
assert not 1 < 2 > 3

View File

@ -27,3 +27,6 @@ def f():
assert value == 1 assert value == 1
f() f()
from math import *
assert pi > 3

View File

@ -1,3 +1,14 @@
try:
raise 1
except TypeError:
pass
try:
assert False
exit(1)
except AssertionError:
pass
try: try:
for i in range(5): for i in range(5):
raise KeyError(i) raise KeyError(i)

View File

@ -674,3 +674,11 @@ assert issubclass(object, object) is True
assert issubclass(int, type) is False assert issubclass(int, type) is False
assert issubclass(type, type) is True assert issubclass(type, type) is True
assert issubclass(float, int) is False assert issubclass(float, int) is False
def f(a, b):
c = a
del a
return sum([b, c])
assert f(1, 2) == 3