重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
执行方式:
创新互联不只是一家网站建设的网络公司;我们对营销、技术、服务都有自己独特见解,公司采取“创意+综合+营销”一体化的方式为您提供更专业的服务!我们经历的每一步也许不一定是最完美的,但每一步都有值得深思的意义。我们珍视每一份信任,关注我们的做网站、成都网站建设质量和服务品质,在得到用户满意的同时,也能得到同行业的专业认可,能够为行业创新发展助力。未来将继续专注于技术创新,服务升级,满足企业一站式成都全网营销推广需求,让再小的成都品牌网站建设也能产生价值!lettuce features1
D:\TOOL\PycharmProjects\python2\CS\xingweiqudong>lettuce features1
d:\program files\python\lib\site-packages\fuzzywuzzy\fuzz.py:35: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
Feature: Compute factorial # \features1\zero.feature:1
In order to play with Lettuce # \features1\zero.feature:2
As beginners # \features1\zero.feature:3
we'll implement factorial # \features1\zero.feature:4
Scenario: Factorial of 0 # \features1\zero.feature:6
Given I have the number 0 # \features1\steps.py:37
when I compute its factorial # \features1\steps.py:44
Then I see the number 1 # \features1\steps.py:51
Scenario: Factorial of 1 # \features1\zero.feature:11
Given I have the number 1 # \features1\steps.py:37
when I compute its factorial # \features1\steps.py:44
Then I see the number 1 # \features1\steps.py:51
Scenario: Factorial of 2 # \features1\zero.feature:16
Given I have the number 2 # \features1\steps.py:37
when I compute its factorial # \features1\steps.py:44
Then I see the number 2 # \features1\steps.py:51
Scenario: Factorial of 3 # \features1\zero.feature:21
Given I have the number 3 # \features1\steps.py:37
when I compute its factorial # \features1\steps.py:44
Then I see the number 6 # \features1\steps.py:51
1 feature (1 passed)
4 scenarios (4 passed)
12 steps (12 passed)
D:\TOOL\PycharmProjects\python2\CS\xingweiqudong>lettuce features
d:\program files\python\lib\site-packages\fuzzywuzzy\fuzz.py:35: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
Feature: Compute factorial # \features\zero.feature:1
In order to play with Lettuce # \features\zero.feature:2
As beginners # \features\zero.feature:3
we'll implement factorial # \features\zero.feature:4
Scenario: Factorial of 0 # \features\zero.feature:6
Given I have the number 0 # \features\step.py:13
when I compute its factorial # \features\step.py:18
Then I see the number 1 # \features\step.py:24
Scenario: Factorial of 1 # \features\zero.feature:11
Given I have the number 1 # \features\step.py:13
when I compute its factorial # \features\step.py:18
Then I see the number 1 # \features\step.py:24
Scenario: Factorial of 2 # \features\zero.feature:16
Given I have the number 2 # \features\step.py:13
when I compute its factorial # \features\step.py:18
Then I see the number 2 # \features\step.py:24
Scenario: Factorial of 3 # \features\zero.feature:21
Given I have the number 3 # \features\step.py:13
when I compute its factorial # \features\step.py:18
Then I see the number 6 # \features\step.py:24
Scenario: Factorial of 4 # \features\zero.feature:26
Given I have the number 3 # \features\step.py:13
when I compute its factorial # \features\step.py:18
Then I see the number 6 # \features\step.py:24
Scenario: Factorial of 5 # \features\zero.feature:31
Given I have the number 3 # \features\step.py:13
when I compute its factorial # \features\step.py:18
Then I see the number 6 # \features\step.py:24
Scenario: Factorial of 6 # \features\zero.feature:36
Given I have the number 3 # \features\step.py:13
when I compute its factorial # \features\step.py:18
Then I see the number 6 # \features\step.py:24
1 feature (1 passed)
7 scenarios (7 passed)
21 steps (21 passed)
D:\TOOL\PycharmProjects\python2\CS\xingweiqudong>
# encoding=utf-8
from lettuce import world, steps
def factorial(number):
number = int(number)
if (number == 0) or (number == 1):
return 1
else:
return reduce(lambda x, y: x * y, range(1, number + 1))
@steps
class FactorialSteps(object):
"""Methods in exclude or starting with _ will not be considered as step"""
exclude = ['set_number', 'get_number']
def __init__(self, environs):
# 初始全局变量
self.environs = environs
def set_number(self, value):
# 设置全局变量中的number变量的值
self.environs.number = int(value)
def get_number(self):
# 从全局变量中取出number的值
return self.environs.number
def _assert_number_is(self, expected, msg="Got %d"):
number = self.get_number()
# 断言
assert number == expected, msg % number
def have_the_number(self, step, number):
'''I have the number (\d+)'''
# 上面的三引号引起的代码必须写,并且必须是三引号引起
# 表示从场景步骤中获取需要的数据
# 并将获得数据存到环境变量number中
self.set_number(number)
def i_compute_its_factorial(self, step):
"""When I compute its factorial"""
number = self.get_number()
# 调用factorial方法进行阶乘结算,
# 并将结算结果存于全局变量中的number中
self.set_number(factorial(number))
def check_number(self, step, expected):
'''I see the number (\d+)'''
# 上面的三引号引起的代码必须写,并且必须是三引号引起
# 表示从场景步骤中获取需要的数据以便断言测试结果
self._assert_number_is(int(expected))
FactorialSteps(world)
Feature: Compute factorial
In order to play with Lettuce
As beginners
we'll implement factorial
Scenario: Factorial of 0
Given I have the number 0
when I compute its factorial
Then I see the number 1
Scenario: Factorial of 1
Given I have the number 1
when I compute its factorial
Then I see the number 1
Scenario: Factorial of 2
Given I have the number 2
when I compute its factorial
Then I see the number 2
Scenario: Factorial of 3
Given I have the number 3
when I compute its factorial
Then I see the number 6
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。