MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / test_copyable

Method test_copyable

tests/fields/test_file_field.py:516–533  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

514 assert test_file.the_file.read() == b"Hello, World!"
515
516 def test_copyable(self):
517 class PutFile(Document):
518 the_file = FileField()
519
520 PutFile.drop_collection()
521
522 text = b"Hello, World!"
523 content_type = "text/plain"
524
525 putfile = PutFile()
526 putfile.the_file.put(text, content_type=content_type)
527 putfile.save()
528
529 class TestFile(Document):
530 name = StringField()
531
532 assert putfile == copy.copy(putfile)
533 assert putfile == copy.deepcopy(putfile)
534
535 @require_pil
536 def test_get_image_by_grid_id(self):

Callers

nothing calls this directly

Calls 4

PutFileClass · 0.85
drop_collectionMethod · 0.80
putMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected