def test_lines_for(): build = Builder() extend_builder(build) for section in build.sections: if section != "1": assert build.lines_for(section) print section, build.lines_for(section) assert_equal( len(build.lines_for(section)), 2, "lines for section %s != 2" % (section))
def test_next_statement(): build = Builder() build.next_statement({ "command": "include", "file": "test.py", "section": "test section", "format": "html", "lines": [] }) assert_equal(len(build.exports), 1) assert_equal(len(build.sections), 1) build.next_statement({ "command": "export", "section": "test other section", "language": "python", "lines": []}) build.end() assert_equal(len(build.exports), 2)
def test_next_anonymous(): build = Builder() assert_equal(build.index, 1) assert_equal(build.next_anonymous(), "2")
def test_end(): build = Builder() build.export("Test","python") build.end() assert_equal( len(build.exports), 2, "end didn't start a new anonymous section")
def test_export(): build = Builder() build.export("1.0", "python") assert_equal( len(build.exports), 1, "export didn't create new section")
def test_include(): build = Builder() build.include("test.py", "1.0", "html") assert_equal( len(build.exports), 1, "include didn't create a new section")