[conduit: 69/138] Easy way to test if 2 datatypes are compatible
- From: John Carr <johncarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit: 69/138] Easy way to test if 2 datatypes are compatible
- Date: Thu, 21 May 2009 03:32:43 -0400 (EDT)
commit c067013b12bfc2c8d22f671504fa316fea49ebe9
Author: John Carr <john carr unrouted co uk>
Date: Sun May 3 04:15:49 2009 -0700
Easy way to test if 2 datatypes are compatible
---
test/soup/data/__init__.py | 5 +++++
test/soup/test_datatypes.py | 4 ++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/test/soup/data/__init__.py b/test/soup/data/__init__.py
index 0d70ae4..d75fab7 100644
--- a/test/soup/data/__init__.py
+++ b/test/soup/data/__init__.py
@@ -64,6 +64,11 @@ class DataWrapper(object):
tovisit.extend(n.__bases__)
yield (cls.get_datatype(), n, cls)
+ @classmethod
+ def is_compatible(cls, datatype):
+ compatible = list(cls.get_compatible_datatypes())
+ return datatype in compatible
+
def load_modules():
basepath = os.path.dirname(__file__)
for root, dirs, files in os.walk(basepath):
diff --git a/test/soup/test_datatypes.py b/test/soup/test_datatypes.py
index 9beb6a9..467bbd7 100644
--- a/test/soup/test_datatypes.py
+++ b/test/soup/test_datatypes.py
@@ -41,6 +41,10 @@ def make_testcase(wrp):
others = list(self.wrapper.get_compatible_datatypes())
assert len(others) > 1
+ def test_is_compatible(self):
+ """ Should be compatible with self """
+ assert self.wrapper.is_compatible(self.wrapper.get_datatype())
+
return TestDatatype
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]