← Back to team overview

oship-dev team mailing list archive

[Branch ~oship-dev/oship/devel] Rev 476: Added parent and name method in Pathable class. Bug #614863.

 

------------------------------------------------------------
revno: 476
committer: Wagner Francisco Mezaroba <wagner@wagner-laptop>
branch nick: oship
timestamp: Wed 2010-09-01 11:57:16 -0300
message:
  Added parent and name method in Pathable class. Bug #614863.
added:
  src/oship/openehr/rm/common/archetyped/tests/common.py
modified:
  src/oship/openehr/rm/common/archetyped/__init__.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/common/archetyped/__init__.py'
--- src/oship/openehr/rm/common/archetyped/__init__.py	2010-08-01 16:37:49 +0000
+++ src/oship/openehr/rm/common/archetyped/__init__.py	2010-09-01 14:57:16 +0000
@@ -19,7 +19,14 @@
 
     grok.implements(IPathable)
 
-
+    def __init__(self, parent=None):
+        self.__parent__ = parent
+
+    def parent(self):
+        return self.__parent__
+
+    def name(self):
+        return self.__name__
 
     def pathOfItem(an_item):
         """

=== added file 'src/oship/openehr/rm/common/archetyped/tests/common.py'
--- src/oship/openehr/rm/common/archetyped/tests/common.py	1970-01-01 00:00:00 +0000
+++ src/oship/openehr/rm/common/archetyped/tests/common.py	2010-09-01 14:57:16 +0000
@@ -0,0 +1,24 @@
+"""
+Do a Python test on the app.
+
+:Test-Layer: python
+"""
+import unittest
+import grok
+
+from oship.openehr.rm.common.archetyped import Pathable
+
+class PathableTest(unittest.TestCase):
+
+    def setUp(self):
+        # Pathable is abstract and should not be instantiated. 
+        self.parent = u'parent'
+        self.pathable1 = Pathable()
+        self.pathable2 = Pathable(self.parent)
+
+    def tearDown(self):
+        pass
+
+    def testParentMethod(self):
+        self.assertEqual(None, self.pathable1.parent())
+        self.assertEqual(self.parent, self.pathable2.parent())