From 4cd6c5b3a57cc391d00dde2a5a4e8f5cbc1e0d3d Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 14 Oct 2018 10:56:44 +0200 Subject: [PATCH] Fix ordering of prototype diff output for test --- evennia/prototypes/menus.py | 3 ++- evennia/prototypes/tests.py | 38 +++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/evennia/prototypes/menus.py b/evennia/prototypes/menus.py index 041d596f36..1aad01cc79 100644 --- a/evennia/prototypes/menus.py +++ b/evennia/prototypes/menus.py @@ -2004,7 +2004,8 @@ def _format_diff_text_and_options(diff, **kwargs): ("diff", diff)), **kwargs))}) optnum += 1 else: - for key, subdiffpart in diffpart.items(): + for key in sorted(list(diffpart.keys())): + subdiffpart = diffpart[key] text, option, optnum = _parse_diffpart( subdiffpart, optnum, *(args + (key, ))) texts.extend(text) diff --git a/evennia/prototypes/tests.py b/evennia/prototypes/tests.py index cb30dc8f42..7269b4a90a 100644 --- a/evennia/prototypes/tests.py +++ b/evennia/prototypes/tests.py @@ -400,6 +400,8 @@ class _MockMenu(object): class TestMenuModule(EvenniaTest): + maxDiff = None + def setUp(self): super(TestMenuModule, self).setUp() @@ -583,31 +585,31 @@ class TestMenuModule(EvenniaTest): 'prelogout_location': (('prelogout_location', "#2", None, ''), ('prelogout_location', "#2", None, ''), 'KEEP')}, - 'home': ('#2', '#2', 'KEEP'), - 'key': ('TestChar', 'TestChar', 'KEEP'), - 'locks': ('boot:false();call:false();control:perm(Developer);delete:false();' - 'edit:false();examine:perm(Developer);get:false();msg:all();' - 'puppet:false();tell:perm(Admin);view:all()', - 'boot:false();call:false();control:perm(Developer);delete:false();' - 'edit:false();examine:perm(Developer);get:false();msg:all();' - 'puppet:false();tell:perm(Admin);view:all()', - 'KEEP'), - 'permissions': {'developer': ('developer', 'developer', 'KEEP')}, - 'prototype_desc': ('Testobject build', None, 'REMOVE'), - 'prototype_key': ('TestDiffKey', 'TestDiffKey', 'KEEP'), - 'prototype_locks': ('spawn:all();edit:all()', 'spawn:all();edit:all()', 'KEEP'), - 'prototype_tags': {}, - 'tags': {'foo': (None, ('foo', None, ''), 'ADD')}, - 'typeclass': ('typeclasses.characters.Character', - 'typeclasses.characters.Character', 'KEEP')} + 'home': ('#2', '#2', 'KEEP'), + 'key': ('TestChar', 'TestChar', 'KEEP'), + 'locks': ('boot:false();call:false();control:perm(Developer);delete:false();' + 'edit:false();examine:perm(Developer);get:false();msg:all();' + 'puppet:false();tell:perm(Admin);view:all()', + 'boot:false();call:false();control:perm(Developer);delete:false();' + 'edit:false();examine:perm(Developer);get:false();msg:all();' + 'puppet:false();tell:perm(Admin);view:all()', + 'KEEP'), + 'permissions': {'developer': ('developer', 'developer', 'KEEP')}, + 'prototype_desc': ('Testobject build', None, 'REMOVE'), + 'prototype_key': ('TestDiffKey', 'TestDiffKey', 'KEEP'), + 'prototype_locks': ('spawn:all();edit:all()', 'spawn:all();edit:all()', 'KEEP'), + 'prototype_tags': {}, + 'tags': {'foo': (None, ('foo', None, ''), 'ADD')}, + 'typeclass': ('typeclasses.characters.Character', + 'typeclasses.characters.Character', 'KEEP')} texts, options = olc_menus._format_diff_text_and_options(obj_diff) self.assertEqual( "\n".join(texts), '- |wattrs:|n \n' + ' |gKEEP|W:|n desc |W=|n This is User #1. |W(category:|n None|W, locks:|n |W)|n\n' ' |c[1] |yADD|n|W:|n None |W->|n foo |W=|n bar |W(category:|n None|W, locks:|n |W)|n\n' ' |gKEEP|W:|n prelogout_location |W=|n #2 |W(category:|n None|W, locks:|n |W)|n\n' - ' |gKEEP|W:|n desc |W=|n This is User #1. |W(category:|n None|W, locks:|n |W)|n\n' '- |whome:|n |gKEEP|W:|n #2\n' '- |wkey:|n |gKEEP|W:|n TestChar\n' '- |wlocks:|n |gKEEP|W:|n boot:false();call:false();control:perm(Developer);delete:false();edit:false();examine:perm(Developer);get:false();msg:all();puppet:false();tell:perm(Admin);view:all()\n'