99 Bottles of OOP examples in Python 3.
-
To spend 30 minutes on your own solution, following Appendix B, clone the repo.
-
lib/bottles.py
is an empty placeholder file waiting for your solution. -
test/bottles_test.py
is the equivalent of the initial test suite in Ruby included in theb-exercise
branch in the book's repo. -
A proper run of the suite with an empty
lib/bottles.py
file should return:
$ cat lib/bottles.py
$ python3.6 test/bottles_test.py
Traceback (most recent call last):
File "test/bottles_test.py", line 10, in <module>
from lib.bottles import Bottles
ImportError: cannot import name 'Bottles'
- If you only put an empty
Bottles
class in this file, the same command would return validunittest
output like this:
$ cat lib/bottles.py
class Bottles(object):
pass
$ python3.6 test/bottles_test.py
sssEssss
======================================================================
ERROR: test_the_first_verse (__main__.BottlesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/bottles_test.py", line 20, in test_the_first_verse
assert expected == Bottles().verse(99)
AttributeError: 'Bottles' object has no attribute 'verse'
----------------------------------------------------------------------
Ran 8 tests in 0.001s
FAILED (errors=1, skipped=7)