Skip to content

Commit d0c445b

Browse files
moved the unit testing material to lesson 4, and started a new intorduction to test driven development.
1 parent c4b914b commit d0c445b

8 files changed

Lines changed: 1427 additions & 98 deletions

File tree

‎source/class_schedule/lesson04.rst‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
.. _session_1_04:
22

3-
################################################
4-
Session 4: Dictionaries, Sets, and File Handling
5-
################################################
3+
##############################################
4+
Session 4: Unit Testing, Dictionaries and Sets
5+
##############################################
66

7-
Dictionaries, Sets, and File Handling
87

98
Readings
109
========
1110

1211
.. toctree::
1312
:maxdepth: 1
1413

14+
../modules/Testing
15+
../modules/TestDrivenDevelopment
1516
../modules/DictsAndSets
16-
../modules/Files
1717
../modules/DictionaryAsSwitch
1818

1919
Recommended Additional Reading
@@ -33,7 +33,7 @@ Exercises:
3333
.. toctree::
3434
:maxdepth: 1
3535

36+
../exercises/unit_testing.rst
3637
../exercises/dict_lab.rst
37-
../exercises/file_lab.rst
3838
../exercises/mailroom-part2.rst
3939
../exercises/kata_fourteen.rst

‎source/class_schedule/lesson05.rst‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
.. _session_1_05:
22

3-
########################################
4-
Session 5: Exceptions and Comprehensions
5-
########################################
6-
7-
Exceptions and Comprehensions
3+
#######################################################
4+
Lession 5: File Handling, Exceptions and Comprehensions
5+
#######################################################
86

97

108
Readings
@@ -13,8 +11,8 @@ Readings
1311
.. toctree::
1412
:maxdepth: 1
1513

14+
../modules/Files
1615
../modules/NamingThings
17-
../modules/Modules
1816
../modules/Documentation
1917
../modules/Exceptions
2018
../modules/Comprehensions
@@ -26,6 +24,7 @@ Exercises:
2624
.. toctree::
2725
:maxdepth: 1
2826

27+
../exercises/file_lab.rst
2928
../exercises/exceptions_lab.rst
3029
../exercises/except_exercise.rst
3130
../exercises/comprehensions_lab.rst

‎source/class_schedule/lesson06.rst‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
.. _session_1_06:
22

33
################################################
4-
Session 6: Testing and Advanced Argument Passing
4+
Session 6: Advanced Argument Passing and Modules
55
################################################
66

7-
Unit Testing and Advanced Argument Passing
7+
Advanced Argument Passing
88

99
Readings
1010
========
1111

1212
.. toctree::
1313
:maxdepth: 1
1414

15-
16-
../modules/Testing
1715
../modules/AdvancedArgumentPassing
1816
../modules/MoreOnMutability
17+
../modules/Modules
1918

2019
Supplemental Reading
2120
--------------------
@@ -31,7 +30,6 @@ Exercises:
3130
.. toctree::
3231
:maxdepth: 1
3332

34-
../exercises/unit_testing.rst
3533
../exercises/args_kwargs_lab.rst
3634
../exercises/mailroom-part4.rst
3735

‎source/class_schedule/lesson08.rst‎

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ Session 8: Properties and Magic methods
66

77
More OO: Properties and Magic methods.
88

9-
Pre-class prep
10-
==============
11-
129
Readings
13-
--------
10+
========
1411

15-
**Read:**
12+
.. toctree::
13+
:maxdepth: 1
1614

17-
* :ref:`properties`
15+
../modules/Properties
16+
../modules/StaticAndClassMethods
17+
../modules/SpecialMethodsAndProtocols
1818

19-
* :ref:`special_methods`
19+
Supplemental Readings
20+
---------------------
2021

2122
About Python's "magic methods":
2223

@@ -30,30 +31,21 @@ A Good Book (dead trees version only):
3031

3132
(Dusty is a local boy and co-founder of PuPPy)
3233

33-
And:
34-
35-
36-
37-
In-class Activities
38-
===================
3934

40-
Exercises
41-
---------
35+
Exercises:
36+
==========
4237

43-
Finish (or make more progress on...) html_render.
38+
.. toctree::
39+
:maxdepth: 1
4440

45-
:ref:`exercise_circle_class`
41+
../exercises/circle_class.rst
4642

47-
Optional: :ref:`exercise_sparse_array`
43+
Optional Exercise:
44+
------------------
4845

4946
This one is challenging -- if you have got html_render and circle class done, then by all means -- it's a great exercise. but if you are still struggling with html_render -- get that done first.
5047

48+
.. toctree::
49+
:maxdepth: 1
5150

52-
Post-class Activities
53-
=====================
54-
55-
Finish the exercises
56-
57-
Look at the next session for reading, etc:
58-
59-
:ref:`session_1_09`
51+
../exercises/sparse_array.rst

‎source/class_schedule/lesson09.rst‎

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ Session 9: Static and class methods: multiple inheritance
55
#########################################################
66

77

8-
Pre-class prep
9-
==============
8+
Readings
9+
========
1010

11-
Reading:
12-
--------
11+
.. toctree::
12+
:maxdepth: 1
1313

14-
* :ref:`static_and_class_methods`
14+
../modules/MultipleInheritance
1515

16-
* :ref:`multiple_inheritance`
17-
18-
Supplemental Reading:
16+
Supplemental Readings
1917
---------------------
2018

2119
Multiple Inheritance and the Diamond Problem
@@ -35,29 +33,10 @@ https://www.python.org/download/releases/2.3/mro/
3533
http://python-history.blogspot.com/2010/06/method-resolution-order.html
3634

3735

36+
Exercises:
37+
==========
3838

39-
In-class Activities
40-
===================
41-
42-
Exercises
43-
---------
44-
45-
Finish up the Circle Exercise
46-
47-
:ref:`exercise_circle_class`
48-
49-
Make an Object Oriented mailroom!
50-
51-
:ref:`exercise_mailroom_oo`
52-
53-
Post-class Activities
54-
=====================
55-
56-
Finish the exercises
57-
58-
Look at the next session for reading, etc:
59-
60-
:ref:`session_1_10`
61-
62-
39+
.. toctree::
40+
:maxdepth: 1
6341

42+
../exercises/mailroom-oo.rst

‎source/class_schedule/lesson10.rst‎

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,22 @@ Session 10: Intro to Functional Programming: lambda and Map, Filter, Reduce
66

77
Functional Programming
88

9-
Topics:
9+
Reading:
10+
========
1011

11-
* Object Objected Programming vs Functional Programming
12-
* Functions as First Class Objects
13-
* Map/Filter/Reduce
12+
.. toctree::
13+
:maxdepth: 1
1414

15+
../modules/OO_vs_functional
16+
../modules/Lambda
17+
../modules/MapFilterReduce
18+
../modules/IPythonParallel
1519

16-
Pre-class prep
17-
==============
18-
19-
20-
Reading
21-
-------
22-
23-
:ref:`oo_vs_functional`
24-
25-
:ref:`anonymous_functions`
26-
27-
:ref:`map_filter_reduce`
28-
29-
30-
In-class Activities
31-
===================
3220

3321
Exercises
34-
---------
22+
=========
23+
24+
It's now time to catch up on everything you haven't quite finished.
25+
In particular, you should finish an object oriented mailroom that is fully complete and unit tested.
3526

36-
.. :ref:`exercise_trapezoidal_rule`
3727

38-
:ref:`exercise_mailroom_fp`
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
"""
2+
roman.py
3+
4+
A Roman numeral to arabic numeral (and back!) converter
5+
6+
complete with tests
7+
8+
tests are expected to be able to be run with the pytest system
9+
"""
10+
11+
KNOWN_VALUES = ( (1, 'I'),
12+
(2, 'II'),
13+
(3, 'III'),
14+
(4, 'IV'),
15+
(5, 'V'),
16+
(6, 'VI'),
17+
(7, 'VII'),
18+
(8, 'VIII'),
19+
(9, 'IX'),
20+
(10, 'X'),
21+
(50, 'L'),
22+
(100, 'C'),
23+
(500, 'D'),
24+
(1000, 'M'),
25+
(31, 'XXXI'),
26+
(148, 'CXLVIII'),
27+
(294, 'CCXCIV'),
28+
(312, 'CCCXII'),
29+
(421, 'CDXXI'),
30+
(528, 'DXXVIII'),
31+
(621, 'DCXXI'),
32+
(782, 'DCCLXXXII'),
33+
(870, 'DCCCLXX'),
34+
(941, 'CMXLI'),
35+
(1043, 'MXLIII'),
36+
(1110, 'MCX'),
37+
(1226, 'MCCXXVI'),
38+
(1301, 'MCCCI'),
39+
(1485, 'MCDLXXXV'),
40+
(1509, 'MDIX'),
41+
(1607, 'MDCVII'),
42+
(1754, 'MDCCLIV'),
43+
(1832, 'MDCCCXXXII'),
44+
(1993, 'MCMXCIII'),
45+
(2074, 'MMLXXIV'),
46+
(2152, 'MMCLII'),
47+
(2212, 'MMCCXII'),
48+
(2343, 'MMCCCXLIII'),
49+
(2499, 'MMCDXCIX'),
50+
(2574, 'MMDLXXIV'),
51+
(2646, 'MMDCXLVI'),
52+
(2723, 'MMDCCXXIII'),
53+
(2892, 'MMDCCCXCII'),
54+
(2975, 'MMCMLXXV'),
55+
(3051, 'MMMLI'),
56+
(3185, 'MMMCLXXXV'),
57+
(3250, 'MMMCCL'),
58+
(3313, 'MMMCCCXIII'),
59+
(3408, 'MMMCDVIII'),
60+
(3501, 'MMMDI'),
61+
(3610, 'MMMDCX'),
62+
(3743, 'MMMDCCXLIII'),
63+
(3844, 'MMMDCCCXLIV'),
64+
(3888, 'MMMDCCCLXXXVIII'),
65+
(3940, 'MMMCMXL'),
66+
(3999, 'MMMCMXCIX'),
67+
)
68+
69+
70+
def test_to_roman_known_values():
71+
"""
72+
to_roman should give known result with known input
73+
"""
74+
for integer, numeral in KNOWN_VALUES:
75+
result = roman1.to_roman(integer)
76+
assert numeral == result
77+
78+

0 commit comments

Comments
 (0)