예제 #1
0
파일: tests.py 프로젝트: v3sk0o0/FizzBuzz
    def test_002(self):

        for i in range(3,15,3):
            self.assertEqual(fizzbuzz(i), "Fizz")

        for i in range(5,15,5):
            self.assertEqual(fizzbuzz(i), "Buzz")
 def test_fizzbuzz(self):
     self.assertEqual(fizzbuzz(3), "Fizz")
     self.assertEqual(fizzbuzz(12), "Fizz")
     self.assertEqual(fizzbuzz(5), "Buzz")
     self.assertEqual(fizzbuzz(25), "Buzz")
     self.assertEqual(fizzbuzz(15), "FizzBuzz")
     self.assertEqual(fizzbuzz(4), "")
     self.assertEqual(fizzbuzz(8), "")
 def test_fizzbuzz(self):
     self.assertEqual(fizzbuzz(3), "Fizz")
     self.assertEqual(fizzbuzz(12), "Fizz")
     self.assertEqual(fizzbuzz(5), "Buzz")
     self.assertEqual(fizzbuzz(25), "Buzz")
     self.assertEqual(fizzbuzz(15), "FizzBuzz")
     self.assertEqual(fizzbuzz(4), "")
     self.assertEqual(fizzbuzz(8), "")
예제 #4
0
 def test_5_renvoie_5(self):
     self.assertEqual("buzz", fizzbuzz(5))
예제 #5
0
 def test_retorna_1_ao_receber_1(self):
     self.assertEqual(fizzbuzz(1), '1')
예제 #6
0
 def test_fizzbuzz(self):
     self.assertEqual(fizzbuzz(1), 1)
예제 #7
0
 def test_retorna_4_ao_receber_4(self):
     self.assertEqual(fizzbuzz(4), '4')
예제 #8
0
 def test_retorna_fizz_ao_receber_10(self):
     self.assertEqual(fizzbuzz(10), 'buzz')
예제 #9
0
 def test_retorna_fizz_ao_receber_10(self):
     self.assertEqual(fizzbuzz(10), 'buzz')
예제 #10
0
 def test_retorna_1_ao_receber_1(self):
     self.assertEqual(fizzbuzz(1), '1')
예제 #11
0
 def test_entra_1_sai_1(self):
     self.assertEqual(fizzbuzz(1), '1')
예제 #12
0
 def test_retorna_4_ao_receber_4(self):
     self.assertEqual(fizzbuzz(4), '4')
예제 #13
0
 def test_3_renvoie_3(self):
     self.assertEqual("fizz", fizzbuzz(3))
예제 #14
0
 def test_entra_15_sai_FizzBuzz(self):
     self.assertEqual(fizzbuzz(15), DIV3 + DIV5)
예제 #15
0
파일: tests.py 프로젝트: v3sk0o0/FizzBuzz
 def test_001(self):
     self.assertEqual(fizzbuzz(15), "FizzBuzz")
예제 #16
0
파일: tests.py 프로젝트: v3sk0o0/FizzBuzz
 def test_000(self):
     self.assertEqual(fizzbuzz(0), "FizzBuzz")
예제 #17
0
def test_answer():
    assert fizzbuzz(3) == 'Fizz'
    assert fizzbuzz(5) == 'Buzz'
    assert fizzbuzz(15) == 'FizzBuzz'
    assert fizzbuzz(4) == 4
예제 #18
0
    #            expect(result).to(equal('Buzz'))
    #    with context ('When number is 15'):
    #        with it('Returns FizzBuzz'):
    #            number = 15
    #
    #            result = fizzbuzz(number)

    #            expect(result).to(equal('FizzBuzz'))

    with context('When number is divisible by 3'):
        with context('and not by 5'):
            with it('Returns Fizz'):
                numbers = [6, 9, 12]

                for number in numbers:
                    result = fizzbuzz(number)

                    expect(result).to(equal('Fizz'))

    with context('When number is divisible by 5 and not by 3'):
        with it('Returns Buzz'):
            numbers = [5, 10, 20, 100]

            for number in numbers:
                result = fizzbuzz(number)

                expect(result).to(equal('Buzz'))

    with context('When number is divisible by 15 and does not have a 3'):
        with it('Returns FizzBuzz'):
            numbers = [15, 45, 60, 75, 90]
예제 #19
0
"""
We will use this script to teach Python to absolute beginners
The script is an example of Fizz-Buzz implemented in Python

The FizzBuzz problem: 
For all integers between 1 and 99 (include both):
    # print fizz for multiples of 3
    # print buzz for multiples of 5 
    # print fizzbuzz for multiples of 3 and 5"
"""
import fizzbuzz

#----START OF SCRIPT
if __name__=='__main__':
    fizzbuzz(100)
예제 #20
0
 def test_entra_30_sai_FizzBuzz(self):
     self.assertEqual(fizzbuzz(30), DIV3 + DIV5)
예제 #21
0
 def test_6_renvoie_6(self):
     self.assertEqual("fizz", fizzbuzz(6))
예제 #22
0
 def test_entra_2_sai_2(self):
     self.assertEqual(fizzbuzz(2), '2')
예제 #23
0
 def test_10_renvoie_10(self):
     self.assertEqual("buzz", fizzbuzz(10))
예제 #24
0
 def test_retorna_buzz_ao_receber_5(self):
     self.assertEqual(fizzbuzz(5), 'buzz')
예제 #25
0
 def test_15_renvoie_15(self):
     self.assertEqual("fizzbuzz", fizzbuzz(15))
예제 #26
0
 def test_retorna_fizzbuzz_ao_receber_15(self):
     self.assertEqual(fizzbuzz(15), 'fizzbuzz')
예제 #27
0
 def test_30_renvoie_30(self):
     self.assertEqual("fizzbuzz", fizzbuzz(30))
예제 #28
0
 def test_retorna_2_ao_receber_2(self):
     self.assertEqual(fizzbuzz(2), '2')
예제 #29
0
 def test_50_renvoie_50(self):
     self.assertEqual("buzz", fizzbuzz(50))
예제 #30
0
 def test_retorna_buzz_ao_receber_5(self):
     self.assertEqual(fizzbuzz(5), 'buzz')
예제 #31
0
 def test_1_renvoie_1(self):
     self.assertEqual(1, fizzbuzz(1))
예제 #32
0
 def test_retorna_fizzbuzz_ao_receber_15(self):
     self.assertEqual(fizzbuzz(15), 'fizzbuzz')
예제 #33
0
 def test_2_renvoie_2(self):
     self.assertEqual(2, fizzbuzz(2)) 
예제 #34
0
 def test_retorna_2_ao_receber_2(self):
     self.assertEqual(fizzbuzz(2), '2')
예제 #35
0
 def test_entra_multiplo3_naomultiplo5_sai_Fizz(self):
     self.assertEqual(fizzbuzz(3), DIV3)
     self.assertEqual(fizzbuzz(6), DIV3)
     self.assertEqual(fizzbuzz(9), DIV3)
예제 #36
0
 def test_fizzbuzz(self):
     self.assertEqual(fizzbuzz(3), 'fizz')
예제 #37
0
 def test_entra_multiplo5_naomultiplo3_sai_Buzz(self):
     self.assertEqual(fizzbuzz(5), DIV5)
     self.assertEqual(fizzbuzz(10), DIV5)
     self.assertEqual(fizzbuzz(20), DIV5)