Skip to content

Commit ab2a3e5

Browse files
committed
using doctest
1 parent f7ec06d commit ab2a3e5

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

3-tier.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def __init__(self):
3131
def get_product_list(self):
3232
print('PRODUCT LIST:')
3333
for product in self.business_logic.product_list():
34-
print(product)
34+
#print(product)
35+
yield product
3536
print('')
3637

3738
def get_product_information(self, product):

null.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,40 @@ def __str__(self):
3636

3737

3838
def test():
39-
"""Perform some decent tests, or rather: demos."""
39+
"""
40+
Perform some decent tests, or rather: demos.
41+
>>> print(Null())
42+
Null
43+
>>> print(Null('value'))
44+
Null
45+
>>> n= Null('vale',param='value')
46+
>>> print(n)
47+
Null
48+
>>> n()
49+
<Null>
50+
>>> n('value')
51+
<Null>
52+
>>> n('value', param='value')
53+
<Null>
54+
>>> print(n)
55+
Null
56+
"""
4057

4158
# constructing and calling
4259

43-
n = Null()
44-
print(n)
60+
#n = Null()
61+
#print(n)
4562

46-
n = Null('value')
47-
print(n)
63+
#n = Null('value')
64+
#print(n)
4865

4966
n = Null('value', param='value')
50-
print(n)
67+
#print(n)
5168

5269
n()
53-
n('value')
54-
n('value', param='value')
55-
print(n)
70+
#n('value')
71+
#n('value', param='value')
72+
#print(n)
5673

5774
# attribute handling
5875

@@ -81,7 +98,8 @@ def test():
8198

8299
if __name__ == '__main__':
83100
test()
84-
101+
import doctest
102+
doctest.testmod()
85103
### OUTPUT ###
86104
# Null
87105
# Null

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy