Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1.39 KB

generated_project_py.md

File metadata and controls

45 lines (34 loc) · 1.39 KB

tests/py/generated_project.py

"""Python unittest test file generated by Python Package phmutest."""
import unittest

from phmutest.globs import Globals as _phmGlobals
from phmutest.printer import Printer as _phmPrinter
from phmutest.skip import sys_tool as _phm_sys

_phm_globals = None
_phm_testcase = unittest.TestCase()
_phm_testcase.maxDiff = None
_phm_log = []


class Test001(unittest.TestCase):
    """Test cases generated from tests/md/project.md."""

    def tests(self):

        # ------ tests/md/project.md:11 ------
        with self.subTest(msg="tests/md/project.md:11"):
            with _phmPrinter(_phm_log, "tests/md/project.md:11", False) as _phm_printer:

                def greeting(name: str) -> str:
                    return "Hello" + "\n\n" + name

                print(greeting("World!"))
                # line 21
                _phm_expected_str = """\
Hello

World!
"""
                _phm_printer.cancel_print_capture_on_error()
                _phm_testcase.assertEqual(_phm_expected_str, _phm_printer.stdout())

        # ------ tests/md/project.md:29 ------
        with self.subTest(msg="tests/md/project.md:29"):
            with _phmPrinter(_phm_log, "tests/md/project.md:29", False):
                text = greeting("Planet!")
                text = text.replace("\n\n", " ")
                assert text == "Hello Planet!"  # this assert is in the Markdown example.