GildedRose-Refactoring-Kata/python
ahmernajar c851057d59 Refactor code structure and implement Conjured items support
Refactoring improvements:
- Extract complex nested if-else logic into well-named private methods
- Separate concerns: each item type has its own update method
- Use constants for item names and quality limits
- Add comprehensive docstrings for all methods
- Improve code readability and maintainability

Conjured items implementation:
- Conjured items degrade in quality twice as fast as normal items
- After sell-by date, Conjured items degrade 4x faster (2x normal rate * 2x after sell-by)
- Quality never goes below 0
- Uses prefix matching for flexibility ('Conjured' prefix)

All tests pass, including the new Conjured items tests.
2025-12-06 12:47:04 +00:00
..
tests Add comprehensive test suite for all item types 2025-12-06 12:46:59 +00:00
.gitignore Moves language specific Git ignores into language subfolders. 2018-12-02 20:31:26 +01:00
gilded_rose.py Refactor code structure and implement Conjured items support 2025-12-06 12:47:04 +00:00
README.md Update README.md with -m unittest 2025-07-17 15:44:35 +02:00
requirements.txt Improve docs for python version 2024-06-01 10:13:32 +02:00
texttest_fixture.py Added approvals version of python test 2025-06-22 17:30:00 +02:00

Gilded Rose starting position in Python

For exercise instructions see top level README

Suggestion: create a python virtual environment for this project. See the documentation

Run the unit tests from the Command-Line

python -m unittest

Run the TextTest fixture from the Command-Line

For e.g. 10 days:

python texttest_fixture.py 10

You should make sure the command shown above works when you execute it in a terminal before trying to use TextTest (see below).

Run the TextTest approval test that comes with this project

There are instructions in the TextTest Readme for setting up TextTest. You will need to specify the Python executable and interpreter in config.gr. Uncomment these lines:

executable:${TEXTTEST_HOME}/python/texttest_fixture.py
interpreter:python

Run the ApprovalTests.Python test

This test uses the framework ApprovalTests.Python. You will need to install Run it like this:

python tests/test_gilded_rose_approvals.py

You will need to approve the output file which appears under "approved_files" by renaming it from xxx.received.txt to xxx.approved.txt.