From 0454c4458f23f1043418d2ef47057507867f6cab Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sat, 12 May 2018 19:37:09 -0300 Subject: [PATCH] Fix tests in Python 3.5 In 3.6 dictionaries are ordered, but not in 3.5 --- tests/test_html.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/test_html.py b/tests/test_html.py index 67696963..8c512c8f 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -1,4 +1,5 @@ from bs4 import BeautifulSoup as Soup +from collections import OrderedDict from .fixtures import app_client import pytest import re @@ -79,20 +80,20 @@ def test_add_filter_redirects(app_client): def test_existing_filter_redirects(app_client): - filter_args = { - '_filter_column_1': 'name', - '_filter_op_1': 'contains', - '_filter_value_1': 'hello', - '_filter_column_2': 'age', - '_filter_op_2': 'gte', - '_filter_value_2': '22', - '_filter_column_3': 'age', - '_filter_op_3': 'lt', - '_filter_value_3': '30', - '_filter_column_4': 'name', - '_filter_op_4': 'contains', - '_filter_value_4': 'world', - } + filter_args = OrderedDict(( + ('_filter_column_1', 'name'), + ('_filter_op_1', 'contains'), + ('_filter_value_1', 'hello'), + ('_filter_column_2', 'age'), + ('_filter_op_2', 'gte'), + ('_filter_value_2', '22'), + ('_filter_column_3', 'age'), + ('_filter_op_3', 'lt'), + ('_filter_value_3', '30'), + ('_filter_column_4', 'name'), + ('_filter_op_4', 'contains'), + ('_filter_value_4', 'world'), + )) path_base = app_client.get( '/test_tables/simple_primary_key', allow_redirects=False, gather_request=False ).headers['Location']