Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lurst/trivia_kata
🥋 Trivia Kata for Python 3
https://github.com/lurst/trivia_kata
golden-test kata python refactor
Last synced: 6 days ago
JSON representation
🥋 Trivia Kata for Python 3
- Host: GitHub
- URL: https://github.com/lurst/trivia_kata
- Owner: LuRsT
- Created: 2017-12-16T12:07:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-02T20:34:41.000Z (over 6 years ago)
- Last Synced: 2024-11-18T19:48:58.990Z (2 months ago)
- Topics: golden-test, kata, python, refactor
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Trivia Kata for Python 3
This is basically a copy of https://github.com/jbrains/trivia/ except that it's
just the Python one, and I changed it to be used with Python 3.## How to setup:
Create a virtualenv with Python 3.* (tested in Python3.6) and install `pytest`.
## How to run:
Just use the `Makefile`:
- `make` to run unit tests
- `make gold` to run golden testAlternatively, read the Makefile and execute the commands inside, it's just 4 lines.
## How to kata this kata:
This is a Refactoring Kata, you get some code that could be improved and what
you do is write some code and refactor until can't do it anymore.I will leave a golden test, but it's a good exercise to write them yourself,
there's also a failing unit test that you can fix and start hacking on.Text taken from: http://legacycoderetreat.typepad.com/
### More guided practice
I run Legacy Code Retreat with more guidance than a typical Code Retreat. I have so far used these exercises in this sequence:
- Do anything you like, but try to add tests changing the code as little as you can.
- Use the Golden Master technique to generate characterisation tests (I make this a 20-minute iteration and explain the exercise below).
- Practise using the Subclass to Test refactoring.
- Practise using Subclass to Test, followed immediately by Replace Inheritance with Delegation.
- Practise extracting Pure Functions, that is, functions with no side effects. (Be careful! You think there's no side effects, but if can't mark the function as abstract/class-level, then there might still be side effects!)As always, write whatever tests will help you do these things safely and correctly. Whatever you do, do what you don't normally do!
After each iteration, throw away your changes except for the Golden Master
exercise. I recommend that people keep their Golden Master to help them with
the other exercises.For the last two iterations of the day, keep the changes after iteration 1, but
switch partners.