432: @head(1,'A python test') 433: Test the test_python function. 434: @test_python(hlevel=2,descr='A simple test',source_terminator='//') 435: print 'A simple test' 436: //
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.
449: @head(1,'A diff OK test') 450: Test the test_python function. 451: @test_python(hlevel=2,\ 452: descr='A diff OK test',source_terminator='//', expected_terminator='//') 453: print 'A simple diff test' 454: print 'A simple diff test line 2' 455: print 'A simple diff test line 3' 456: // 457: A simple diff test 458: A simple diff test line 2 459: A simple diff test line 3 460: //
And here's one that should fail: On-the-fly interscript for test 12 follows.
464: @head(1,'A diff fail test') 465: Test the test_python function. 466: @test_python(hlevel=2,\ 467: descr='A diff test',source_terminator='//', expected_terminator='//') 468: print 'A simple diff test' 469: print 'A simple diff test line 2' 470: print 'A simple diff test line 3' 471: // 472: A simple diff test 473: A simple diff test line 2 CHANGED 474: A simple diff test line 3 475: //