add _id property to GridFile instances
This commit is contained in:
parent
705dae8598
commit
786f1de795
@ -164,6 +164,12 @@ class GridFile(object):
|
||||
|
||||
self.__collection.chunks.remove({"files_id": self.__id})
|
||||
|
||||
@property
|
||||
def _id(self):
|
||||
"""Get the value of ``"_id"`` for this :class:`GridFile`.
|
||||
"""
|
||||
return self.__id
|
||||
|
||||
@property
|
||||
def closed(self):
|
||||
"""Is this :class:`GridFile` closed?
|
||||
|
||||
@ -426,6 +426,10 @@ class TestGridFile(unittest.TestCase):
|
||||
|
||||
self.assertEqual(in_data, out_data)
|
||||
|
||||
def test_id(self):
|
||||
file = GridFile({"_id": "test"}, self.db, "w")
|
||||
self.assertEqual("test", file._id)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user