From a34fd9ac89c3ebd294f57d4b471fb6f5b31e1e91 Mon Sep 17 00:00:00 2001 From: Thomas Erker <35792856+th-erker@users.noreply.github.com> Date: Thu, 8 Mar 2018 11:25:36 +0000 Subject: [PATCH] Add testcase for #1751 --- tests/document/class_methods.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/document/class_methods.py b/tests/document/class_methods.py index dd3addb7..8701b4b2 100644 --- a/tests/document/class_methods.py +++ b/tests/document/class_methods.py @@ -187,6 +187,19 @@ class ClassMethodsTest(unittest.TestCase): self.assertEqual(BlogPostWithTags.compare_indexes(), { 'missing': [], 'extra': [] }) self.assertEqual(BlogPostWithCustomField.compare_indexes(), { 'missing': [], 'extra': [] }) + def test_compare_indexes_for_text_indexes(self): + """ Ensure that compare_indexes behaves correctly for text indexes """ + + class Doc(Document): + a = StringField() + meta = { 'indexes': ['$a']} + + Doc.drop_collection() + Doc.ensure_indexes() + actual = Doc.compare_indexes() + expected = {'missing': [], 'extra': []} + self.assertEqual(actual, expected) + def test_list_indexes_inheritance(self): """ ensure that all of the indexes are listed regardless of the super- or sub-class that we call it from