# AUTOGENERATED! DO NOT EDIT! File to edit: 04_tests.ipynb (unless otherwise specified).

__all__ = ['test_eq', 'test_stdout']

# Cell
from .main import run
from io import StringIO
from contextlib import redirect_stdout

# Cell
def test_eq(a, b):
    "test a equals b"
    assert a==b, f"test failed, {a} not equal to {b}"

# Cell
def test_stdout(f, args, exp):
    "test that `f` print out `exp` to stdout."
    s = StringIO()
    with redirect_stdout(s):
        f(args)
    test_eq(s.getvalue(), f'{exp}\n' if len(exp)>0 else '')