def test_document_one_field(self): document = Document() field = Field(name="test_name", type="string") document.add_fields(field) self.assertEqual(document.fields, [field]) self.assertEqual(document, Document.from_dict(document.to_dict)) self.assertEqual(document, Document([field]))
def test_document_two_fields(self): document = Document() field_1 = Field(name="test_name", type="string") field_2 = Field( name="body", type="string", indexing=["index", "summary"], index="enable-bm25", ) document.add_fields(field_1, field_2) self.assertEqual(document.fields, [field_1, field_2]) self.assertEqual(document, Document.from_dict(document.to_dict)) self.assertEqual(document, Document([field_1, field_2]))