我正在尝试为PostgreSQL函数编写测试。我无法理解为什么我的PostgreSQL函数什么都不返回。
def test_sql_func_get_loc_eft_draft_one(session):
test_passed = True
# Build up the test environment
trans = session.begin()
# Add a dummy location record
add_dummy_location(session)
# Add a dummy membership record
add_one_dummy_member(session)
# Print the membership record we just wrote
req_query = session.query(models.Membership).\
filter(models.Membership.home_club == 9999).first()
print(req_query)
# Run the test with one record
t1 = session.query(func.get_dues(9999, '1/1/2014', '1/1/2016')).first()
print(t1)
try:
assert t1[0] == 10.00
except:
test_passed = False
# Break down the test environment
trans.rollback()
assert test_passed
当我打印我写的会员记录时,它会正确显示,在会话字段中显示10.00。当我尝试使用该函数来检索会费时,零返回,并且测试失败。我不能在交易中使用PostgreSQL函数调用吗?