Skip to content

Instantly share code, notes, and snippets.

@isidore
Created November 9, 2017 12:11
Show Gist options
  • Save isidore/501f8bc9c8c4ae9fd59b0faa76bcbe4e to your computer and use it in GitHub Desktop.
Save isidore/501f8bc9c8c4ae9fd59b0faa76bcbe4e to your computer and use it in GitHub Desktop.
FizzBuzz Mob Solution from Agile Coaching DC Meetup
from unittest import TestCase
class FizzBuzz(object):
@classmethod
def convert(cls, param):
if (param % 3 == 0 and param % 5 ==0):
return str("FizzBuzz")
if (param % 3 == 0):
return str("Fizz")
if (param % 5 == 0):
return str("Buzz")
return str(param)
class FizzBuzzTest(TestCase):
def test_something(self):
# 1 => 1
result = FizzBuzz.convert(1)
self.assertEquals(result, "1")
def test_something2(self):
# 2 => 2
result = FizzBuzz.convert(2)
self.assertEquals(result, "2")
def test_something_fizz(self):
# 3 => Fizz
result = FizzBuzz.convert(3)
self.assertEquals(result, "Fizz")
def test_something_buzz(self):
# 5 => Buzz
result = FizzBuzz.convert(5)
self.assertEquals(result, "Buzz")
def test_something_fizz6(self):
# 6 => Fizz
result = FizzBuzz.convert(6)
self.assertEquals(result, "Fizz")
def test_something_buzz10(self):
# 10 => Buzz
result = FizzBuzz.convert(10)
self.assertEquals(result, "Buzz")
def test_something_fizzbuzz(self):
# 15 => FizzBuzz
result = FizzBuzz.convert(15)
self.assertEquals(result, "FizzBuzz")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment