Improve health of this package (#1409)

* added flake8 and flake8-import-order to travis for py27

* fixed a test that fails from time to time depending on an order of a dict

* flake8 tweaks for the entire codebase excluding tests
This commit is contained in:
Stefan Wójcik
2016-11-28 19:00:34 -05:00
committed by GitHub
parent 5135185e31
commit 3c455cf1c1
22 changed files with 354 additions and 299 deletions

View File

@@ -844,7 +844,12 @@ class IndexesTest(unittest.TestCase):
self.assertEqual({'text': 'OK', '_id': {'term': 'ok', 'name': 'n'}},
report.to_mongo())
self.assertEqual(report, ReportDictField.objects.get(pk=my_key))
# We can't directly call ReportDictField.objects.get(pk=my_key),
# because dicts are unordered, and if the order in MongoDB is
# different than the one in `my_key`, this test will fail.
self.assertEqual(report, ReportDictField.objects.get(pk__name=my_key['name']))
self.assertEqual(report, ReportDictField.objects.get(pk__term=my_key['term']))
def test_string_indexes(self):