Skip to content

Commit

Permalink
Fixing custom_indexes testing
Browse files Browse the repository at this point in the history
Signed-off-by: Wayne Witzel III <wwitzel3@gmail.com>
  • Loading branch information
wwitzel3 authored and Rick Copeland committed Dec 16, 2011
1 parent 6ac2386 commit 935fa79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -3,6 +3,7 @@
*-py2.6.egg
*.log
*.pyc
*.swp
*/.coverage
.coverage
/cover/
Expand All @@ -14,4 +15,4 @@ download/*
install/*
build/*
dist/*
docs/_build/*
docs/_build/*
2 changes: 1 addition & 1 deletion ming/metadata.py
Expand Up @@ -108,7 +108,7 @@ def _process_collection_args(args, kwargs):
if a.sparse:
indexes.append(Index(a.name, unique=True, sparse=True))
else:
indexes.append(Index(a.name, unique=True))
indexes.append(Index(a.name, unique=True, sparse=False))
elif a.sparse:
indexes.append(Index(a.name, unique=False, sparse=True))
elif a.index:
Expand Down
3 changes: 3 additions & 0 deletions ming/tests/test_declarative.py
Expand Up @@ -199,6 +199,8 @@ class __mongometa__:
self.MyDoc.__mongometa__.indexes)
self.assertEqual(MyChild.__mongometa__.unique_indexes,
self.MyDoc.__mongometa__.unique_indexes)
self.assertEqual(MyChild.__mongometa__.custom_indexes,
self.MyDoc.__mongometa__.custom_indexes)

def test_index_inheritance_both(self):
class MyChild(self.MyDoc):
Expand All @@ -209,6 +211,7 @@ class __mongometa__:
unique_indexes = [
('test4',),
]
custom_indexes = []
class MyGrandChild(MyChild):
class __mongometa__:
indexes = [
Expand Down

0 comments on commit 935fa79

Please sign in to comment.