|
- # Just some helpers for test functions
-
- import shutil, os
-
- def eq_(a, b):
- if not a == b:
- raise AssertionError("%r != %r" % (a, b))
-
- def in_(a, b):
- if a not in b:
- if not isinstance(a, basestring):
- a = repr(a)
- else:
- a = '"' + a + '"'
- if not isinstance(b, basestring):
- b = repr(b)
- else:
- b = '"' + b + '"'
- raise AssertionError("%s not in %s" % (a, b))
-
- def ne_(a, b):
- if not a != b:
- raise AssertionError("unexpected %r == %r" % (a, b))
-
- def recursive_unlink(path):
- try:
- shutil.rmtree(path)
- except OSError:
- pass
- try:
- os.unlink(path)
- except OSError:
- pass
|