当前位置: 首页>>代码示例>>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;未经允许,请勿转载。