Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def prints_hello_name_chaining():
"""prints hello name (chaining)"""
check50.run("python3 foo.py").stdin("bar").stdout("hello bar").stdin("baz").stdout("hello baz")
def test_returns_process(self):
self.process = check50.run("python3 ./{self.filename}")
def test_compile_hello_world(self):
with open("hello.c", "w") as f:
src = '#include \n'\
'int main() {\n'\
' printf("hello, world!\\n");\n'\
'}'
f.write(src)
check50.c.compile("hello.c")
self.assertTrue(os.path.isfile("hello"))
check50.run("./hello").stdout("hello, world!", regex=False)
def prints_hello_name_non_chaining():
"""prints hello name (non chaining)"""
check50.run("python3 foo.py").stdin("bar\nbaz").stdout("hello bar").stdout("hello baz")
def runpy(self):
self.process = check50.run(f"python3 ./{self.filename}")
def prints_hello_name_non_chaining_prompt():
"""prints hello name (non chaining) (prompt)"""
check50.run("python3 foo.py").stdin("bar\nbaz", prompt=True).stdout("hello bar").stdout("hello baz")
def compile(file_name, exe_name=None):
if exe_name is None and file_name.endswith(".c"):
exe_name = file_name.split(".c")[0]
out_flag = f"-o {exe_name}" if exe_name is not None else ""
check50.run(f"{CC} {file_name} {out_flag} {CFLAGS}").exit(0)