當前位置: 首頁>>代碼示例>>Python>>正文


Python app.FizzBuzz類代碼示例

本文整理匯總了Python中app.FizzBuzz的典型用法代碼示例。如果您正苦於以下問題:Python FizzBuzz類的具體用法?Python FizzBuzz怎麽用?Python FizzBuzz使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FizzBuzz類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_run

    def test_run(self):
        output = StringIO()

        app = FizzBuzz()
        app.run(100, output)

        self.failIf(len(output.getvalue().splitlines()) != 100)
開發者ID:GoaLitiuM,項目名稱:seng2016,代碼行數:7,代碼來源:test.py

示例2: test_run

    def test_run(self):
        output = StringIO()

        app = FizzBuzz()
        app.run(100, output)
        op = len(output.getvalue().splitlines())
        print "Outputlines: " + str(op)
        self.failIf(op != 99)
開發者ID:chwieser,項目名稱:otlabra,代碼行數:8,代碼來源:test.py

示例3: test_three

 def test_three(self):
     app = FizzBuzz()
     output = StringIO()
     app.run(100, output)
     
     self.failIf(output.getvalue().splitlines().count("Fizz") != 26)
     self.failIf(output.getvalue().splitlines().count("Buzz") != 13)
     self.failIf(output.getvalue().splitlines().count("FizzBuzz") != 6)
開發者ID:aneijone,項目名稱:seng2016,代碼行數:8,代碼來源:test.py

示例4: test_prime

    def test_prime(self):
        app = FizzBuzz()
        output = StringIO()
        app.run(100, output)

        lista = output.getvalue().splitlines()
        primecount = ['is a prime' in x for x in lista]
        self.failIf(primecount.count(True) !=25)
開發者ID:aneijone,項目名稱:seng2016,代碼行數:8,代碼來源:test.py

示例5: test_V2_primes

    def test_V2_primes(self):
        app = FizzBuzz()

        self.failIf(app.calc(7) !=  "7 is a prime")
        self.failIf(app.calc(11) !=  "11 is a prime")
        self.failIf(app.calc(19) !=  "19 is a prime")
        self.failIf(app.calc(23) !=  "23 is a prime")
        self.failIf(app.calc(31) !=  "31 is a prime")
開發者ID:mattiy,項目名稱:seng2016,代碼行數:8,代碼來源:test.py

示例6: test_two

    def test_two(self):
        app = FizzBuzz()
        output = StringIO()
        app.run(50, output)
#        print output.getvalue().splitlines()[2]
        self.failIf(output.getvalue().splitlines()[0] != "1")
        self.failIf(output.getvalue().splitlines()[5] != "Fizz")
        self.failIf(output.getvalue().splitlines()[9] != "Buzz")
        self.failIf(output.getvalue().splitlines()[14] != "FizzBuzz")   
        self.failIf(output.getvalue().splitlines()[44] != "FizzBuzz")   
開發者ID:aneijone,項目名稱:seng2016,代碼行數:10,代碼來源:test.py

示例7: test_buzz

    def test_buzz(self):
    app = FizzBuzz()

    self.failIf(app.calc(10) != "Buzz")
    self.failIf(app.calc(100) != "Buzz")
開發者ID:GoaLitiuM,項目名稱:seng2016,代碼行數:5,代碼來源:test.py

示例8: test_nonprimes

    def test_nonprimes(self):
        app = FizzBuzz()
        f = open('nonprimes.txt', 'r')
        for line in f:
            self.failIf(app.is_prime(int(line)) != False)
開發者ID:jburysek,項目名稱:otlabra,代碼行數:5,代碼來源:test.py

示例9: test_fizz

    def test_fizz(self):
    app = FizzBuzz()

    self.failIf(app.calc(6) != "Fizz")
    self.failIf(app.calc(18) != "Fizz")
    self.failIf(app.calc(99) != "Fizz")
開發者ID:GoaLitiuM,項目名稱:seng2016,代碼行數:6,代碼來源:test.py

示例10: test_primes

 def test_primes(self):
     app = FizzBuzz()
     for i in (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97):
         self.failIf(app.calc(i) != "is a prime")
開發者ID:eelaukka,項目名稱:seng2016,代碼行數:4,代碼來源:test.py

示例11: test_five

 def test_five(self):
     app = FizzBuzz()
     self.failIf(app.calc(15) != "FizzBuzz")
     self.failIf(app.calc(30) != "FizzBuzz")
開發者ID:wonkale,項目名稱:seng2016,代碼行數:4,代碼來源:test.py

示例12: test_three

 def test_three(self):
    app = FizzBuzz()
    self.failIf(app.calc(6) != "Fizz")
    self.failIf(app.calc(9) != "Fizz")
開發者ID:wonkale,項目名稱:seng2016,代碼行數:4,代碼來源:test.py

示例13: test_fizz

 def test_fizz(self):
     app=FizzBuzz()
     self.failIf(app.calc(9) = "Fizz")
開發者ID:tappoman,項目名稱:seng2016,代碼行數:3,代碼來源:test.py

示例14: test_5_7

 def test_5_7(self):
     app = FizzBuzz()
     self.failIf(app.calc(10) != "Buzz")
     self.failIf(app.calc(20) != "Buzz")
開發者ID:wonkale,項目名稱:seng2016,代碼行數:4,代碼來源:test.py

示例15: test_two

 def test_two(self):
     app = FizzBuzz()
     self.failIf(app.calc(6) != "Fizz")
開發者ID:eelaukka,項目名稱:seng2016,代碼行數:3,代碼來源:test.py


注:本文中的app.FizzBuzz類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。