本文整理汇总了Python中app.FizzBuzz.run方法的典型用法代码示例。如果您正苦于以下问题:Python FizzBuzz.run方法的具体用法?Python FizzBuzz.run怎么用?Python FizzBuzz.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.FizzBuzz
的用法示例。
在下文中一共展示了FizzBuzz.run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run
# 需要导入模块: from app import FizzBuzz [as 别名]
# 或者: from app.FizzBuzz import run [as 别名]
def test_run(self):
output = StringIO()
app = FizzBuzz()
app.run(100, output)
self.failIf(len(output.getvalue().splitlines()) != 100)
示例2: test_run
# 需要导入模块: from app import FizzBuzz [as 别名]
# 或者: from app.FizzBuzz import run [as 别名]
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)
示例3: test_three
# 需要导入模块: from app import FizzBuzz [as 别名]
# 或者: from app.FizzBuzz import run [as 别名]
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)
示例4: test_prime
# 需要导入模块: from app import FizzBuzz [as 别名]
# 或者: from app.FizzBuzz import run [as 别名]
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)
示例5: test_two
# 需要导入模块: from app import FizzBuzz [as 别名]
# 或者: from app.FizzBuzz import run [as 别名]
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")