本文整理汇总了Python中behave.userdata.UserData.getint方法的典型用法代码示例。如果您正苦于以下问题:Python UserData.getint方法的具体用法?Python UserData.getint怎么用?Python UserData.getint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类behave.userdata.UserData
的用法示例。
在下文中一共展示了UserData.getint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getbool__with_unknown_param_returns_default_value
# 需要导入模块: from behave.userdata import UserData [as 别名]
# 或者: from behave.userdata.UserData import getint [as 别名]
def test_getbool__with_unknown_param_returns_default_value(self):
userdata = UserData()
value = userdata.getint("param", 1.2)
assert isinstance(value, float)
self.assertEqual(value, 1.2)
示例2: test_getint__with_unknown_param_without_default_returns_zero
# 需要导入模块: from behave.userdata import UserData [as 别名]
# 或者: from behave.userdata.UserData import getint [as 别名]
def test_getint__with_unknown_param_without_default_returns_zero(self):
userdata = UserData()
value = userdata.getint("param")
self.assertEqual(value, 0)
示例3: test_getint__with_unknown_param_returns_default_value
# 需要导入模块: from behave.userdata import UserData [as 别名]
# 或者: from behave.userdata.UserData import getint [as 别名]
def test_getint__with_unknown_param_returns_default_value(self):
userdata = UserData()
value = userdata.getint("param", 123)
assert isinstance(value, int)
assert value == 123
示例4: test_getint__with_known_param_and_valid_text
# 需要导入模块: from behave.userdata import UserData [as 别名]
# 或者: from behave.userdata.UserData import getint [as 别名]
def test_getint__with_known_param_and_valid_text(self):
userdata = UserData(param="42")
value = userdata.getint("param")
assert isinstance(value, int)
self.assertEqual(value, 42)
示例5: test_getint__with_known_param_and_invalid_text_raises_ValueError
# 需要导入模块: from behave.userdata import UserData [as 别名]
# 或者: from behave.userdata.UserData import getint [as 别名]
def test_getint__with_known_param_and_invalid_text_raises_ValueError(self):
userdata = UserData(param="__BAD_NUMBER__")
with pytest.raises(ValueError):
userdata.getint("param")