MCPcopy Create free account
hub / github.com/SplootCode/splootcode / testDecorator

Method testDecorator

python/tests/test_execute.py:405–426  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

403 self.assertEqual(f.read(), "helLO\n")
404
405 def testDecorator(self):
406 splootFile = splootFromPython('''
407def do_twice(func):
408 def inner():
409 func()
410 func()
411 return inner
412
413@do_twice
414def say_hello():
415 print("hello")
416
417say_hello()
418''')
419
420 f = io.StringIO()
421 f.write = wrapStdout(f.write)
422 with contextlib.redirect_stdout(f):
423 executePythonFile(splootFile)
424
425 f.seek(0)
426 self.assertEqual(f.read(), "hello\nhello\n")
427
428
429

Callers

nothing calls this directly

Calls 4

splootFromPythonFunction · 0.90
wrapStdoutFunction · 0.90
executePythonFileFunction · 0.90
readMethod · 0.80

Tested by

no test coverage detected