Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The feature for using alternate divisors (other than 3 and 5) does not work #1

Open
jawwad opened this issue Jul 12, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@jawwad
Copy link
Collaborator

jawwad commented Jul 12, 2020

Note: This is an exercise for the Forking Workflow chapter of the RayWenderlich Mastering Git Book

In 85ca623 a feature was added to allow divisors other than 3 and 5 to be used for Fizz and Buzz. However, this feature does not work since the parameters added to the method signature were not actually used anywhere in the code.

In the following block of code lines 6 and 8 were the ones that were added. However, lines 11 and 12 were never updated to actually use these new parameters. The 3 in line 11 should have been updated to use fizz_divisor and the 5 in line 12 should have been updated to use buzz_divisor.

https://github.com/raywenderlich/git-book-fizzbuzz/blob/85ca623d39b416a78fe97d61a27cfa46b8a4755e/fizzbuzz.py#L4-L13

The following test was added as part of the same commit but it looks like the test may not have been run since it is currently failing.
https://github.com/raywenderlich/git-book-fizzbuzz/blob/85ca623d39b416a78fe97d61a27cfa46b8a4755e/test_fizzbuzz.py#L37-L45

I receive the following output if I run the tests via python test_fizzbuzz.py. Instead of printing Fizz for 7, Buzz for 11 and FizzBuzz for 77 it just prints the numbers:

test_divisible_by_both (__main__.TestFizzBuzz) ... ok
test_divisible_by_five (__main__.TestFizzBuzz) ... ok
test_divisible_by_none (__main__.TestFizzBuzz) ... ok
test_divisible_by_three (__main__.TestFizzBuzz) ... ok
test_with_alternate_divisors (__main__.TestFizzBuzz) ... test_with_alternate_words (__main__.TestFizzBuzz) ... ok

======================================================================
FAIL: test_with_alternate_divisors (__main__.TestFizzBuzz) [Alternate Divisors: Divisible by First]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_fizzbuzz.py", line 41, in test_with_alternate_divisors
    self.assertEqual(fizzbuzz_for_num(7, fizz_divisor=7, buzz_divisor=11), "Fizz")
AssertionError: '7' != 'Fizz'
- 7
+ Fizz


======================================================================
FAIL: test_with_alternate_divisors (__main__.TestFizzBuzz) [Alternate Divisors: Divisible by Second]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_fizzbuzz.py", line 43, in test_with_alternate_divisors
    self.assertEqual(fizzbuzz_for_num(11, fizz_divisor=7, buzz_divisor=11), "Buzz")
AssertionError: '11' != 'Buzz'
- 11
+ Buzz


======================================================================
FAIL: test_with_alternate_divisors (__main__.TestFizzBuzz) [Alternate Divisors: Divisible by Both]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_fizzbuzz.py", line 45, in test_with_alternate_divisors
    self.assertEqual(fizzbuzz_for_num(77, fizz_divisor=7, buzz_divisor=11), "FizzBuzz")
AssertionError: '77' != 'FizzBuzz'
- 77
+ FizzBuzz


----------------------------------------------------------------------
Ran 6 tests in 0.001s

FAILED (failures=3)

Can someone submit a pull request to fix this issue?

@jawwad jawwad added the bug Something isn't working label Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant