def it_can_append_new_documents(self): doc1 = Article({'id': 1, 'name': 'doc1'}) newspaper = NewsPaper() eq_(0, len(newspaper.collection_set)) newspaper.add(doc1) eq_(1, len(newspaper.collection_set)) eq_([doc1], newspaper.collection_set)
def it_doesnt_add_instances_to_the_collection_that_are_not_documents(self): class A(object): pass newspaper = NewsPaper() eq_(0, len(newspaper.collection_set)) newspaper.add(A()) eq_(0, len(newspaper.collection_set))