r13422 - AGX/agx.io.uml/trunk/src/agx/io/uml

"johannes raggam" <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: thet
Date: Tue Jan 18 14:26:20 2011
New Revision: 13422

Modified:
   AGX/agx.io.uml/trunk/src/agx/io/uml/core.py
   AGX/agx.io.uml/trunk/src/agx/io/uml/core.txt
Log:
bugfix + test

Modified: AGX/agx.io.uml/trunk/src/agx/io/uml/core.py
==============================================================================
--- AGX/agx.io.uml/trunk/src/agx/io/uml/core.py	(original)
+++ AGX/agx.io.uml/trunk/src/agx/io/uml/core.py	Tue Jan 18 14:26:20 2011
@@ -6,6 +6,8 @@
 from zodict.node import Node
 from zodict.interfaces import IRoot
 from zodict.interfaces import ICallableNode
+from agx.io.uml.interfaces import IClass
+from agx.io.uml.interfaces import IInterface
 from agx.io.uml.interfaces import (
     IUMLElement,
     IProfile,
@@ -98,12 +100,10 @@
     def packages(self):
         return self.filtereditems(IPackage)
 
-    # TODO: write test for this failing method
     @property
     def classes(self):
-        return self.filtereditems(IClass)
+       return self.filtereditems(IClass)
 
-    # TODO: write test for this failing method
     @property
     def interfaces(self):
         return self.filtereditems(IInterface)

Modified: AGX/agx.io.uml/trunk/src/agx/io/uml/core.txt
==============================================================================
--- AGX/agx.io.uml/trunk/src/agx/io/uml/core.txt	(original)
+++ AGX/agx.io.uml/trunk/src/agx/io/uml/core.txt	Tue Jan 18 14:26:20 2011
@@ -23,6 +23,30 @@
     <class 'agx.io.uml.core.Model'>: testmodel
       <class 'agx.io.uml.core.Package'>: mypackage
 
+Querying the Package
+--------------------
+    >>> from agx.io.uml.classes import Class
+    >>> from agx.io.uml.classes import Interface
+    >>> model['package2'] = Package()
+    >>> model['package2']['class1'] = Class()
+    >>> model['package2']['class2'] = Class()
+    >>> model['package2']['iface1'] = Interface()
+    >>> model['package2']['iface2'] = Interface()
+    >>> model['package2']['package3'] = Package()
+    
+    >>> list(model['mypackage'].packages)
+    []
+    >>> list(model['mypackage'].classes)
+    []
+    >>> list(model['mypackage'].interfaces)
+    []
+    >>> list(model['package2'].packages)
+    [<Package object 'package3' at ...>]
+    >>> list(model['package2'].classes)
+    [<Class object 'class1' at ...>, <Class object 'class2' at ...>]
+    >>> list(model['package2'].interfaces)
+    [<Interface object 'iface1' at ...>, <Interface object 'iface2' at ...>]
+
 
 Adding Profile to model
 -----------------------
@@ -58,4 +82,9 @@
         <class 'agx.io.uml.core.Profile'>: myprofile
         <class 'agx.io.uml.core.Stereotype'>: mystereotype
           <class 'agx.io.uml.core.TaggedValue'>: mytgv
-          
\ No newline at end of file
+      <class 'agx.io.uml.core.Package'>: package2
+        <class 'agx.io.uml.classes.Class'>: class1
+        <class 'agx.io.uml.classes.Class'>: class2
+        <class 'agx.io.uml.classes.Interface'>: iface1
+        <class 'agx.io.uml.classes.Interface'>: iface2
+        <class 'agx.io.uml.core.Package'>: package3

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.