396: @head(1,'A python test') 397: Test the test_python function. 398: @test_python(hlevel=2,descr='A simple test',source_terminator='//') 399: print 'A simple test' 400: //
The test is also registered in a table of tests.
It is also possible to provide expected output: Interscript will verify your code by comparing the expected and actual output, and print a difference table if the test failed. Note that the difference table is only available if the module "interscript.utilities.diff" is available and operates correctly: the current implementation uses GNU diff invoked using "os.system()". Here's an example that veifies OK: On-the-fly interscript for test 11 follows.
413: @head(1,'A diff OK test') 414: Test the test_python function. 415: @test_python(hlevel=2,\ 416: descr='A diff OK test',source_terminator='//', expected_terminator='//') 417: print 'A simple diff test' 418: print 'A simple diff test line 2' 419: print 'A simple diff test line 3' 420: // 421: A simple diff test 422: A simple diff test line 2 423: A simple diff test line 3 424: //
And here's one that should fail: On-the-fly interscript for test 12 follows.
428: @head(1,'A diff fail test') 429: Test the test_python function. 430: @test_python(hlevel=2,\ 431: descr='A diff test',source_terminator='//', expected_terminator='//') 432: print 'A simple diff test' 433: print 'A simple diff test line 2' 434: print 'A simple diff test line 3' 435: // 436: A simple diff test 437: A simple diff test line 2 CHANGED 438: A simple diff test line 3 439: //