Skip to content

Commit af11e66

Browse files
author
Lorena Mesa
committed
Began unittests for project
1 parent 521844e commit af11e66

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/sample_cases_test.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import subprocess
2+
import time
3+
from os import remove
4+
from pathlib import Path
5+
import unittest
6+
7+
8+
PROJECT_ROOT = Path(__file__).parent.absolute()
9+
10+
def test_sample_case_one():
11+
subprocess.Popen(
12+
f'python3 main.py --t [email protected] --o lorenaemail',
13+
cwd=f"{PROJECT_ROOT.parent}",
14+
stdin=subprocess.PIPE,
15+
shell=True,
16+
)
17+
18+
time.sleep(1)
19+
20+
output = []
21+
with open(f"{PROJECT_ROOT}/lorenaoutput.png", "rb") as f:
22+
output = f.readlines(); print(output)
23+
output = list(map(lambda l: l.decode("utf-8"), output))
24+
25+
remove(f"{PROJECT_ROOT}/lorenaoutput.png")
26+
27+
assert output == ['Result(value=6, parser=infix, expression="3*2")']

0 commit comments

Comments
 (0)