当前位置: 首页>>代码示例>>Python>>正文


Python Session.commit方法代码示例

本文整理汇总了Python中cbank.model.queries.Session.commit方法的典型用法代码示例。如果您正苦于以下问题:Python Session.commit方法的具体用法?Python Session.commit怎么用?Python Session.commit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cbank.model.queries.Session的用法示例。


在下文中一共展示了Session.commit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_refund_amount_negative

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_refund_amount_negative (self):
     a = Allocation(Project("1"), Resource("1"), 10,
                    datetime.now(), datetime.now())
     c = Charge(a, 5)
     r = Refund(c, -1)
     Session.add(r)
     Session.commit()
开发者ID:anderbubble,项目名称:cbank,代码行数:9,代码来源:test_queries.py

示例2: test_charge_sum_zero

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_charge_sum_zero (self):
     allocation = Allocation(None, None, 0, datetime(2000, 1, 1), datetime(2001, 1, 1))
     allocation.project_id = "project"
     allocation.resource_id = "resource"
     Session.add(allocation)
     Session.commit()
     Session.close()
     allocation = Session.query(Allocation).one()
     assert_equal(allocation._charge_sum, 0)
开发者ID:anderbubble,项目名称:cbank,代码行数:11,代码来源:test_mappers.py

示例3: test_charge_sum_one

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_charge_sum_one (self):
     allocation = Allocation(None, None, 0, datetime(2000, 1, 1), datetime(2001, 1, 1))
     allocation.project_id = "project"
     allocation.resource_id = "resource"
     charge = Charge(allocation, 1)
     Session.add_all([allocation, charge])
     Session.commit()
     Session.close()
     allocation = Session.query(Allocation).one()
     assert_equal(allocation._charge_sum, 1)
开发者ID:anderbubble,项目名称:cbank,代码行数:12,代码来源:test_mappers.py

示例4: test_hold_sum_one

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_hold_sum_one (self):
     allocation = Allocation(None, None, 0, datetime(2000, 1, 1), datetime(2001, 1, 1))
     allocation.project_id = "project"
     allocation.resource_id = "resource"
     hold = Hold(allocation, 1)
     Session.add_all([allocation, hold])
     Session.commit()
     Session.close()
     allocation = Session.query(Allocation).one()
     assert_equal(allocation._active_hold_sum, 1)
开发者ID:anderbubble,项目名称:cbank,代码行数:12,代码来源:test_mappers.py

示例5: test_refund_sum_zero

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_refund_sum_zero (self):
     allocation = Allocation(None, None, 0, datetime(2000, 1, 1), datetime(2001, 1, 1))
     allocation.project_id = "project"
     allocation.resource_id = "resource"
     charge = Charge(allocation, 0)
     Session.add_all([allocation, charge])
     Session.commit()
     Session.close()
     charge = Session.query(Charge).one()
     assert_equal(charge._refund_sum, 0)
开发者ID:anderbubble,项目名称:cbank,代码行数:12,代码来源:test_mappers.py

示例6: test_hold_sum_two_with_one_inactive

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_hold_sum_two_with_one_inactive (self):
     allocation = Allocation(None, None, 0, datetime(2000, 1, 1), datetime(2001, 1, 1))
     allocation.project_id = "project"
     allocation.resource_id = "resource"
     hold_1 = Hold(allocation, 1)
     hold_1.active = False
     hold_2 = Hold(allocation, 2)
     Session.add_all([allocation, hold_1, hold_2])
     Session.commit()
     Session.close()
     allocation = Session.query(Allocation).one()
     assert_equal(allocation._active_hold_sum, 2)
开发者ID:anderbubble,项目名称:cbank,代码行数:14,代码来源:test_mappers.py

示例7: test_refund_sum_two

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_refund_sum_two (self):
     allocation = Allocation(None, None, 0, datetime(2000, 1, 1), datetime(2001, 1, 1))
     allocation.project_id = "project"
     allocation.resource_id = "resource"
     charge = Charge(allocation, 0)
     refund_1 = Refund(charge, 1)
     refund_2 = Refund(charge, 2)
     Session.add_all([allocation, charge, refund_1, refund_2])
     Session.commit()
     Session.close()
     allocation = Session.query(Allocation).one()
     assert_equal(allocation._refund_sum, 3)
开发者ID:anderbubble,项目名称:cbank,代码行数:14,代码来源:test_mappers.py

示例8: test_charge_amount_negative

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_charge_amount_negative (self):
     a = Allocation(Project("1"), Resource("1"), 10,
                    datetime.now(), datetime.now())
     c = Charge(a, -1)
     Session.add(c)
     Session.commit()
开发者ID:anderbubble,项目名称:cbank,代码行数:8,代码来源:test_queries.py

示例9: test_hold_amount_negative

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_hold_amount_negative (self):
     a = Allocation(Project("1"), Resource("1"), 10,
                    datetime.now(), datetime.now())
     h = Hold(a, -1)
     Session.add(h)
     Session.commit()
开发者ID:anderbubble,项目名称:cbank,代码行数:8,代码来源:test_queries.py

示例10: test_allocation_amount_negative

# 需要导入模块: from cbank.model.queries import Session [as 别名]
# 或者: from cbank.model.queries.Session import commit [as 别名]
 def test_allocation_amount_negative (self):
     a = Allocation(Project("1"), Resource("1"), -1,
                    datetime.now(), datetime.now())
     Session.add(a)
     Session.commit()
开发者ID:anderbubble,项目名称:cbank,代码行数:7,代码来源:test_queries.py


注:本文中的cbank.model.queries.Session.commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。