This project is my take on the Gilded Rose refactoring kata by Emily Bache. You can find a detailed overview of this project in a two part guide on my blog. I did it in Python in the least amount of time and detail possible by writing the tests and refactoring only the code order/some logic.
These files contain the intermidiate steps in the refactoring process in the following order:
gilded_rose_extracted.py
gilded_rose_ifs_extracted_unified.py
gilded_rose_ifs_combined.py
Clone the repository and install the prerequisites.
Make sure you have python installed:
sudo apt-get install python3
Install pytest:
pip3 install pytest
Install coverage:
pip3 install coverage
Run the program:
python3 test_gilded_rose.py
python3 texttest_fixture.py
Run the program:
python3 test_gilded_rose.py
Change every “self.assertEquals” to “self.assertEqual” in test_gilded_rose.py and run coverage:
coverage run -m pytest test_gilded_rose.py gilded_rose.py
Check the coverage report:
coverage report -m --include=gilded_rose.py
- Pytest 6.2.2 - testing library used
- Coverage 5.4 - code coverage library used