Skip to content

Commit

Permalink
Began unittests for project
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorena Mesa committed Jul 17, 2024
1 parent 521844e commit af11e66
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/sample_cases_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import subprocess
import time
from os import remove
from pathlib import Path
import unittest


PROJECT_ROOT = Path(__file__).parent.absolute()

def test_sample_case_one():
subprocess.Popen(
f'python3 main.py --t [email protected] --o lorenaemail',
cwd=f"{PROJECT_ROOT.parent}",
stdin=subprocess.PIPE,
shell=True,
)

time.sleep(1)

output = []
with open(f"{PROJECT_ROOT}/lorenaoutput.png", "rb") as f:
output = f.readlines(); print(output)
output = list(map(lambda l: l.decode("utf-8"), output))

remove(f"{PROJECT_ROOT}/lorenaoutput.png")

assert output == ['Result(value=6, parser=infix, expression="3*2")']

0 comments on commit af11e66

Please sign in to comment.