def test_fb(capsys): fb.fizzbuzz() out, err = capsys.readouterr() assert err == '' with open('expected.txt') as fh: expected = fh.read() assert out == expected
def test_fizzbuzz_5div_returns_buzz(num): assert fizzbuzz(num) == 'buzz'
def test_fizzbuzz_regular_returns_self(num): assert fizzbuzz(num) == str(num)
def test_fizzbuzz_returns_str(): assert isinstance(fizzbuzz(1), str)
def test_fizzbuzz_3div_5div_returs_fizzbuzz(num): assert fizzbuzz(num) == 'fizzbuzz'
def test_fizzbuzz_non_mod3_non_mod5_returns_self(num): assert fizzbuzz(num) == str(num)
def test_fizzbuzz_15_returns_fizzbuzz(num): assert fizzbuzz(num) == 'fizzbuzz'
def test_buzz(self): for i in [5, 10, 50]: print('testing', i) assert fizzbuzz(i) == 'Buzz'
def test_fizz(self): self.assertEquals("Fizz", fizzbuzz(3))
def test_buzz(self): self.assertEquals("Buzz",fizzbuzz(5))
def test_neither(self): self.assertEquals(2, fizzbuzz(2))
def test_fizzbuzz_3and5div_returns_fizzbuzz(num): assert fizzbuzz(num) == 'fizzbuzz'
def test_fizz(self): for i in [3, 6, 9, 18]: print('testing', i) assert fizzbuzz(i) == 'Fizz'
def test_fizzbuzz(self): for i in [15, 30, 75]: print('testing', i) assert fizzbuzz(i) == 'FizzBuzz'
def test_fizzbuzz_5_3div_returns_fizzbuzz(num): assert fizzbuzz(num) == 'fizzbuzz'
def test_fizzbuzz_3div_5div_returns_fizzbuzz(num): assert fizzbuzz(num) == "fizzbuzz"
def test_fizzbuzz_return_str(): assert isinstance(fizzbuzz(1), str) # výsledek funkce je instancí stringů
def test_fizzbuzz_15div_return_fizzbuzz(num): assert fizzbuzz(num) == 'fizzbuzz'