6 class TestDetector(test_appliance
.TestAppliance
):
8 def _testDetector(self
, test_name
, data_filename
, detect_filename
):
12 correct_tag
= file(detect_filename
, 'rb').read().strip()
13 node
= compose(file(data_filename
, 'rb'))
14 self
.failUnless(isinstance(node
, SequenceNode
))
15 for scalar
in node
.value
:
16 self
.failUnless(isinstance(scalar
, ScalarNode
))
17 self
.failUnlessEqual(scalar
.tag
, correct_tag
)
21 print file(data_filename
, 'rb').read()
23 print file(detect_filename
, 'rb').read()
24 print "ROOT NODE:", node
25 print "SCALAR NODES:", node
.value
28 TestDetector
.add_tests('testDetector', '.data', '.detect')