Browse Source

Merge branch 'luoxing91-master'

Sakis Kasampalis 11 years ago
parent
commit
37b11da559
2 changed files with 30 additions and 11 deletions
  1. 2 1
      3-tier.py
  2. 28 10
      null.py

+ 2 - 1
3-tier.py

@@ -38,7 +38,8 @@ class Ui(object):
     def get_product_list(self):
         print('PRODUCT LIST:')
         for product in self.business_logic.product_list():
-            print(product)
+            #print(product)
+            yield product
         print('')
 
     def get_product_information(self, product):

+ 28 - 10
null.py

@@ -36,23 +36,40 @@ class Null:
 
 
 def test():
-    """Perform some decent tests, or rather: demos."""
+    """
+    Perform some decent tests, or rather: demos.
+    >>> print(Null())
+    Null
+    >>> print(Null('value'))
+    Null
+    >>> n= Null('vale',param='value')
+    >>> print(n)
+    Null
+    >>> n()
+    <Null>
+    >>> n('value')
+    <Null>
+    >>> n('value', param='value')
+    <Null>
+    >>> print(n)
+    Null
+    """
 
     # constructing and calling
 
-    n = Null()
-    print(n)
+    #n = Null()
+    #print(n)
 
-    n = Null('value')
-    print(n)
+    #n = Null('value')
+    #print(n)
 
     n = Null('value', param='value')
-    print(n)
+    #print(n)
 
     n()
-    n('value')
-    n('value', param='value')
-    print(n)
+    #n('value')
+    #n('value', param='value')
+    #print(n)
 
     # attribute handling
 
@@ -81,7 +98,8 @@ def test():
 
 if __name__ == '__main__':
     test()
-
+    import doctest
+    doctest.testmod()
 ### OUTPUT ###
 # Null
 # Null