本文整理汇总了Python中server.games.game.Game.validity方法的典型用法代码示例。如果您正苦于以下问题:Python Game.validity方法的具体用法?Python Game.validity怎么用?Python Game.validity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.games.game.Game
的用法示例。
在下文中一共展示了Game.validity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_validate_game_settings
# 需要导入模块: from server.games.game import Game [as 别名]
# 或者: from server.games.game.Game import validity [as 别名]
async def test_validate_game_settings(game: Game):
settings = [
('Victory', Victory.SANDBOX, Victory.DEMORALIZATION, ValidityState.WRONG_VICTORY_CONDITION),
('FogOfWar', 'none', 'explored', ValidityState.NO_FOG_OF_WAR),
('CheatsEnabled', 'true', 'false', ValidityState.CHEATS_ENABLED),
('PrebuiltUnits', 'On', 'Off', ValidityState.PREBUILT_ENABLED),
('NoRushOption', 20, 'Off', ValidityState.NORUSH_ENABLED),
('RestrictedCategories', 1, 0, ValidityState.BAD_UNIT_RESTRICTIONS)
]
for data in settings:
key, value, default, expected = data
game.gameOptions[key] = value
await game.validate_game_settings()
assert game.validity is expected
game.gameOptions[key] = default
game.validity = ValidityState.VALID
await game.validate_game_settings()
assert game.validity is ValidityState.VALID