我知道python中与classmethod相关的问题已经被回答了很多次,但即使在实现了这些解决方案之后,我所面临的问题仍然存在。我的代码结构, @classmethod db_obj = cls.get_by_id(ndb.Model function that brings record from db
return db_obj.required_dat
当我运行一个unittest时,请参见下面的代码片段,只有序列中的第一个测试正在通过。测试testPhysicalPrint运行得很好,但是testRecordingItem在NoResultFound异常下失败了--没有为one()找到任何行。但是,如果我从测试类中删除testPhysicalPrint,那么testRecordingItem就能工作。
# Just for Python >=2.7 or &