[telepathy-gabble/master] Add assertFlags{Set,Unset}
Will Thompson
will.thompson at collabora.co.uk
Mon Dec 7 06:06:47 PST 2009
---
tests/twisted/servicetest.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py
index 3a9615d..0634678 100644
--- a/tests/twisted/servicetest.py
+++ b/tests/twisted/servicetest.py
@@ -467,6 +467,20 @@ def assertLength(length, value):
raise AssertionError("expected: length %d, got length %d:\n%s" % (
length, len(value), pretty(value)))
+def assertFlagsSet(flags, value):
+ masked = value & flags
+ if masked != flags:
+ raise AssertionError(
+ "expected flags %u, of which only %u are set in %u" % (
+ flags, masked, value))
+
+def assertFlagsUnset(flags, value):
+ masked = value & flags
+ if masked != 0:
+ raise AssertionError(
+ "expected none of flags %u, but %u are set in %u" % (
+ flags, masked, value))
+
def install_colourer():
def red(s):
return '\x1b[31m%s\x1b[0m' % s
--
1.5.6.5
More information about the telepathy-commits
mailing list