def test_error_args(self, test_input): with pytest.raises(EmmentalDateException): document = Document( _id=test_input["_id"], created_at=test_input["created_at"], updated_at=test_input["updated_at"], )
def test_init(self, test_input, expected): document = Document( _id=test_input["_id"], created_at=test_input["created_at"], updated_at=test_input["updated_at"], ) assert document._id == expected["_id"] assert document.created_at == expected["created_at"] assert document.updated_at == expected["updated_at"]
def test_default_init(self): t_before = int(time.time()) document = Document() t_after = int(time.time()) # assert _id is not undefined assert document._id assert document.created_at assert document.created_at >= t_before assert document.created_at <= t_after assert document.updated_at assert document.updated_at >= t_before assert document.updated_at <= t_after
def from_dict(dict_object: dict): return Document.from_dict_class(dict_object, User)
def from_dict(dict_object: dict): dict_object["total_points"] = int(dict_object["total_points"]) return Document.from_dict_class(dict_object, Challenge)
def from_dict(dict_object: dict): return Document.from_dict_class(dict_object, ChallengeCategory)
def from_dict(dict_object: dict): return Document.from_dict_class(dict_object, ChallengeParticipation)