def __init__(self, name, children=[]):
self.children = children
self.name = name
+ self.nocache = None
def __str__(self):
return self.name
def exists(self):
return 1
def current(self):
return 1
+ def noclean(self):
+ return 1
def tree_case_1(self):
"""Fixture for the render_tree() and print_tree() tests."""
"""
lines = string.split(expect, '\n')[:-1]
- lines = map(lambda l: '[E BSPAC]'+l, lines)
+ lines = map(lambda l: '[E BSPACN ]'+l, lines)
withtags = string.join(lines, '\n') + '\n'
return foo, expect, withtags
- def tree_case_2(self):
+ def tree_case_2(self, prune=1):
"""Fixture for the render_tree() and print_tree() tests."""
stdlib_h = self.Node("stdlib.h")
+-blat.h
| +-stdlib.h
+-bar.h
+ +-[stdlib.h]
"""
+ if not prune:
+ expect = string.replace(expect, '[', '')
+ expect = string.replace(expect, ']', '')
+
lines = string.split(expect, '\n')[:-1]
- lines = map(lambda l: '[E BSPAC]'+l, lines)
+ lines = map(lambda l: '[E BSPACN ]'+l, lines)
withtags = string.join(lines, '\n') + '\n'
return blat_o, expect, withtags
actual = sys.stdout.getvalue()
assert withtags == actual, (withtags, actual)
- node, expect, withtags = self.tree_case_2()
+ node, expect, withtags = self.tree_case_2(prune=0)
sys.stdout = StringIO.StringIO()
print_tree(node, get_children, 1)
assert is_Dict({})
assert is_Dict(UserDict())
assert not is_Dict([])
+ assert not is_Dict(())
assert not is_Dict("")
if hasattr(types, 'UnicodeType'):
exec "assert not is_Dict(u'')"
assert is_List([])
import UserList
assert is_List(UserList.UserList())
+ assert not is_List(())
assert not is_List({})
assert not is_List("")
if hasattr(types, 'UnicodeType'):
assert is_String(UserString.UserString(''))
assert not is_String({})
assert not is_String([])
+ assert not is_String(())
+
+ def test_is_Tuple(self):
+ assert is_Tuple(())
+ assert not is_Tuple([])
+ assert not is_Tuple({})
+ assert not is_Tuple("")
+ if hasattr(types, 'UnicodeType'):
+ exec "assert not is_Tuple(u'')"
def test_to_String(self):
"""Test the to_String() method."""