MCPcopy Create free account
hub / github.com/ActiveState/code / test

Function test

recipes/Python/576912_A_Tree_Finder/recipe-576912.py:141–150  ·  view source on GitHub ↗
(test_data)

Source from the content-addressed store, hash-verified

139 import random
140 import time
141 def test(test_data):
142 fd = StringIO.StringIO()
143 fd.write(test_data)
144 fd.seek(0)
145 r = Reader(fd)
146 for case_id, edges in enumerate(r.gen_edges()):
147 tree_finder = TreeFinder()
148 tree_finder.add_edges(edges)
149 s = '' if tree_finder.isTree() else 'not '
150 print 'Case %d is %sa tree' % (case_id+1, s)
151
152 simple_test_data = '''8 1
1537 3 6 2 8 9 7 5

Callers 1

recipe-576912.pyFile · 0.70

Calls 8

gen_edgesMethod · 0.95
add_edgesMethod · 0.95
isTreeMethod · 0.95
TreeFinderClass · 0.85
ReaderClass · 0.70
enumerateFunction · 0.50
writeMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected