1,760
edits
Changes
→Tests and Test results
== Tests and Test results ==
You must name your class definition python script for Date as <code>a2_class.py</code>. The following test script is scripts are for testing your class definationdefinition. The test script scripts can be used to test the date objects created by using your Date class.
Please review that those tests that failed and try to fix it in your class definition to address the problemany bugs you may have.
=== Test for tomorrow and yesterday methods ===
: Start up an interactive Python session and issue the following python statments:<source lang="python">
[raymond.chan@mtrx-node04pd a2p]$ python3
Python 3.6.8 (default, May 2 2019, 20:40:44)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from a2_class import *
>>> dir()
['Date', '__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'daysb4month', 'int_to_date']
>>> d1 = Date(2019,11,6)
>>> d1.tomorrow()
2019-11-07
>>> d1.yesterday()
2019-11-05
>>> print(d1.tomorrow())
2019/11/07
>>> print(d1.yesterday())
2019/11/05
>>> d2 = Date(2019,2,28)
>>> d2.tomorrow()
2019-03-01
>>> d2.yesterday()
2019-02-27
>>> d3 = Date(2016,2,28)
>>> d3.tomorrow()
2016-02-29
>>> d3.yesterday()
2016-02-27
>>> d4 = Date(2018,12,31)
>>> d4.tomorrow()
2019-01-01
</source>
== Script structure and sample template ==