From 2cce443c4ce150fbc8840ffa7cdeeff3a29e7a4e Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Thu, 31 Jan 2019 20:34:27 -0500 Subject: [PATCH 1/2] use OrderedDict in byteify --- dash/development/component_generator.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dash/development/component_generator.py b/dash/development/component_generator.py index 31f9d1ce9a..99c19051a0 100644 --- a/dash/development/component_generator.py +++ b/dash/development/component_generator.py @@ -146,11 +146,13 @@ def cli(): # pylint: disable=undefined-variable def byteify(input_object): if isinstance(input_object, dict): - return {byteify(key): byteify(value) - for key, value in input_object.iteritems()} + return OrderedDict([ + (byteify(key), byteify(value)) + for key, value in input_object.iteritems() + ]) elif isinstance(input_object, list): return [byteify(element) for element in input_object] - elif isinstance(input_object, unicode): # noqa:F821 + elif isinstance(input_object, unicode): # noqa:F821 return input_object.encode('utf-8') return input_object From d2793c5cfbda448b6cb7be17b7988d147982ad29 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Thu, 31 Jan 2019 20:42:38 -0500 Subject: [PATCH 2/2] lint --- dash/development/_r_components_generation.py | 4 ++-- tests/development/test_base_component.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dash/development/_r_components_generation.py b/dash/development/_r_components_generation.py index 13a57af381..621c9d151e 100644 --- a/dash/development/_r_components_generation.py +++ b/dash/development/_r_components_generation.py @@ -25,8 +25,8 @@ ) component$props <- filter_null(component$props) - - structure(component, class = c('dash_component', 'list')) + + structure(component, class = c('dash_component', 'list')) }}''' # noqa:E501 # the following strings represent all the elements in an object diff --git a/tests/development/test_base_component.py b/tests/development/test_base_component.py index 1fcfa06f9c..a19768a3dc 100644 --- a/tests/development/test_base_component.py +++ b/tests/development/test_base_component.py @@ -280,7 +280,7 @@ def test_set_item_with_nested_children(self): c3b = Component(id='3') self.assertEqual(c5['3'], c3) - self.assertTrue(c5['3'] is not '3') + self.assertTrue(c5['3'] != '3') self.assertTrue(c5['3'] is not c3b) c5['3'] = c3b