'Tests that only one document with an empty list of embedded documents
that have a unique field can be saved, but if the unique field is
also sparse than multiple documents with an empty list can be saved.'

def test_empty_list_embedded_documents_with_unique_field(self):

    class EmbeddedWithUnique(EmbeddedDocument, ):
        number = IntField(unique=True)
    class A(Document, ):
        my_list = ListField(EmbeddedDocumentField(EmbeddedWithUnique))
    A(my_list=[]).save()
    with self.assertRaises(NotUniqueError):
        A(my_list=[]).save()
    class EmbeddedWithSparseUnique(EmbeddedDocument, ):
        number = IntField(unique=True, sparse=True)
    class B(Document, ):
        my_list = ListField(EmbeddedDocumentField(EmbeddedWithSparseUnique))
    A.drop_collection()
    B.drop_collection()
    B(my_list=[]).save()
    B(my_list=[]).save()
