本文整理汇总了Python中user.User.hasRank方法的典型用法代码示例。如果您正苦于以下问题:Python User.hasRank方法的具体用法?Python User.hasRank怎么用?Python User.hasRank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.hasRank方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_user_rank
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import hasRank [as 别名]
def test_user_rank():
reg_user = User('user', '~')
assert reg_user.hasRank('+'), 'rank comparison is off'
reg_user = User('user', '*')
assert reg_user.hasRank('@'), 'rank comparison is off'
reg_user = User('user', '%')
assert reg_user.hasRank('+'), 'rank comparison is off'
示例2: testLowerRankComparision
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import hasRank [as 别名]
def testLowerRankComparision():
reg_user = User('user1', '@')
assert reg_user.hasRank('+'), 'Invalid rank comparision; it should not get @ < +'
示例3: testHigherRankComparision
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import hasRank [as 别名]
def testHigherRankComparision():
reg_user = User('user1')
assert not reg_user.hasRank('~'), 'Invalid rank comparision; it should not get \' \' >= ~'
示例4: testNonexistingRank
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import hasRank [as 别名]
def testNonexistingRank():
false_user = User('user', '=')
assert not false_user.hasRank(' '), 'Nonexisting ranks should not be recognized as anything'
示例5: test_user_rank_untested
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import hasRank [as 别名]
def test_user_rank_untested():
with pytest.raises(UnSpecifiedUserRankException):
reg_user = User('user', '+')
reg_user.hasRank('not valid')
示例6: test_user_owner_privileges
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import hasRank [as 别名]
def test_user_owner_privileges():
reg_user = User('user', ' ')
owner = User('user', ' ', owner=True)
assert owner.hasRank('~'), 'owner is not recognized in rank comparison'
assert owner.isOwner(), 'owner is not owner'
assert not reg_user.isOwner(), 'regular user is recognized as owner'