Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
systemsmanagement:Ardana:8:CentOS:7.5
python-textfsm
textfsm_test_do_not_relay_on_dic_order.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File textfsm_test_do_not_relay_on_dic_order.patch of Package python-textfsm
From 0a1b2a33a4e8ef0484c9f8051ff0b69874ca05e1 Mon Sep 17 00:00:00 2001 From: Alberto Planas <aplanas@gmail.com> Date: Mon, 2 Jul 2018 14:51:21 +0200 Subject: [PATCH] textfsm_test: do not relay on dic order The test `testNestedMatching` compares a list of dictionaries with a string. In Python 2 (and some versions of Python 3) the order of a dictionary is not guaranteed, and this makes the test to fail. This patch compares the raw result with the raw list, and assetEqual takes care of the ordering. --- textfsm_test.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/textfsm_test.py b/textfsm_test.py index c4f7f2c..e92a17b 100755 --- a/textfsm_test.py +++ b/textfsm_test.py @@ -628,10 +628,12 @@ def testNestedMatching(self): data = " Bob: 32 NC\n Alice: 27 NY\n Jeff: 45 CA\nJulia\n\n" # Julia should be parsed as "name" separately result = t.ParseText(data) self.assertEqual( - str(result), ( - "[[[{'name': 'Bob', 'age': '32', 'state': 'NC'}, " - "{'name': 'Alice', 'age': '27', 'state': 'NY'}, " - "{'name': 'Jeff', 'age': '45', 'state': 'CA'}], 'Julia']]" + result, ( + [[[ + {'name': 'Bob', 'age': '32', 'state': 'NC'}, + {'name': 'Alice', 'age': '27', 'state': 'NY'}, + {'name': 'Jeff', 'age': '45', 'state': 'CA'} + ], 'Julia']] )) def testNestedNameConflict(self):
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor