oship-dev team mailing list archive
-
oship-dev team
-
Mailing list archive
-
Message #01611
[Branch ~oship-dev/oship/devel] Rev 512: Enforced an invariant in the TermMapping class. Bug #609150
------------------------------------------------------------
revno: 512
committer: Wagner Francisco Mezaroba <wagner@wagner-laptop>
branch nick: oship
timestamp: Sat 2010-11-20 23:25:08 -0200
message:
Enforced an invariant in the TermMapping class. Bug #609150
modified:
src/oship/openehr/rm/datatypes/text/__init__.py
src/oship/openehr/rm/datatypes/text/tests/termmapping.py
--
lp:oship
https://code.launchpad.net/~oship-dev/oship/devel
Your team OSHIP Development Team is subscribed to branch lp:oship.
To unsubscribe from this branch go to https://code.launchpad.net/~oship-dev/oship/devel/+edit-subscription
=== modified file 'src/oship/openehr/rm/datatypes/text/__init__.py'
--- src/oship/openehr/rm/datatypes/text/__init__.py 2010-11-19 14:15:48 +0000
+++ src/oship/openehr/rm/datatypes/text/__init__.py 2010-11-21 01:25:08 +0000
@@ -24,7 +24,8 @@
def __init__(self,target,match,purpose, terminologyService=None):
self.target = target
if purpose is not None:
- terminologyService.terminology(TerminologyService.OPENEHR).hasCodeForGroupId('Group Id Term Mapping Purpose', purpose)
+ if not terminologyService.terminology(TerminologyService.OPENEHR).hasCodeForGroupId('Group Id Term Mapping Purpose', purpose.definingCode):
+ raise AttributeError(u'Terminology service must have the purpose defining code')
self.purpose = purpose
if match in ['<','>','=','?']:
self.match = match
=== modified file 'src/oship/openehr/rm/datatypes/text/tests/termmapping.py'
--- src/oship/openehr/rm/datatypes/text/tests/termmapping.py 2010-11-19 14:15:48 +0000
+++ src/oship/openehr/rm/datatypes/text/tests/termmapping.py 2010-11-21 01:25:08 +0000
@@ -18,7 +18,7 @@
tm = TermMapping(None, match(), purpose(), DummyTerminologyService(True))
def testShouldNotInitializeWithInvalidPurpose(self):
- tm = TermMapping(None, match(), purpose(), DummyTerminologyService(False))
+ self.assertRaises(AttributeError, TermMapping, None, match(), purpose(), DummyTerminologyService(False))
def match():