Skip to content

Commit 82f1966

Browse files
jcs-instructorgregorrieglernitsanavni4dsherwoodmander11
committed
. t refactor - unhardcode rule
Co-Authored-By: Gregor Riegler <rieglerg85@gmail.com> Co-Authored-By: Nitsan Avni <nitsanav@gmail.com> Co-Authored-By: Joel Silberman <42779942+jcs-instructor@users.noreply.github.com> Co-Authored-By: 4dsherwood <4dsherwood@users.noreply.github.com> Co-Authored-By: Matt <matthew.anderson11@gmail.com>
1 parent 2ab985b commit 82f1966

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

katas/fizzbuzz/test_fizzbuzz.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ def test_buzz_divisor_is_5(fizzbuzz_db):
5656
def make_fizzbuzz(db) -> FizzbuzzFn:
5757
def fizzbuzz_fn(number):
5858
# TODO: get the rule from the db for 5
59-
if number == 5:
60-
return "Buzz"
59+
divisor = 5
60+
word = "Buzz"
61+
if number == divisor:
62+
return word
6163
return "Fizz"
6264
return fizzbuzz_fn
6365

@@ -72,17 +74,16 @@ def test_buzz(fizzbuzz_db):
7274
fizzbuzz_fn = make_fizzbuzz(fizzbuzz_db)
7375
assert "Buzz" == fizzbuzz_fn(5)
7476

75-
def test_different_rules(fizzbuzz_db):
77+
def skip_test_different_rules(fizzbuzz_db):
7678
rules = fizzbuzz_db.fizzbuzz_rules
79+
rules.delete_many(filter={})
7780
rules.insert_many(
7881
[
79-
{"word": "Fizz", "divisor": 3},
80-
{"word": "Buzz", "divisor": 5},
81-
# add Bang, 7
82+
{"word": "Bang", "divisor": 5},
8283
]
8384
)
8485
fizzbuzz_fn = make_fizzbuzz(fizzbuzz_db)
85-
assert "Bang" == fizzbuzz_fn(7)
86+
assert "Bang" == fizzbuzz_fn(5)
8687

8788
def skip_test_15(fizzbuzz_db):
8889
fizzbuzz_fn = make_fizzbuzz(fizzbuzz_db)

session-notes/session-notes-2024-04-25.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,25 @@ Joel
9090
- Next: continue as we are
9191
- Good to do the retro now
9292

93+
### Retro 3
94+
95+
Nitsan
96+
- Wondering about this pattern: many refactorings until the change is very small (possibly 1 line)
97+
- Dilemma: do this on green? or red? (or orange?) We have a relevant failing test. Let's do the simplest thing to pass;
98+
maybe refactor so it's easier & maybe better than refactoring on red. "Orange state" - want a failing test to tell us
99+
where we're going and also the ability to refactor.
100+
101+
Diana
102+
- Request: when talking, make sure to state your intention, and how it fits
103+
- Enjoying the rotations
104+
105+
Joel
106+
- Happy +1 on stating the intention
107+
- Thought this would be simpler than it is; surprised how complicated this is, and how it fits into TDD
108+
- Things getting clearer
109+
- Clear intentions: helps with different ideas people might have
110+
111+
93112
### Final Retro
94113

95114
### How we spent our time today:

0 commit comments

Comments
 (0)