當前位置: 首頁>>代碼示例>>Python>>正文


Python Session.add方法代碼示例

本文整理匯總了Python中cbank.model.queries.Session.add方法的典型用法代碼示例。如果您正苦於以下問題:Python Session.add方法的具體用法?Python Session.add怎麽用?Python Session.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cbank.model.queries.Session的用法示例。


在下文中一共展示了Session.add方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_refund_amount_negative

# 需要導入模塊: from cbank.model.queries import Session [as 別名]
# 或者: from cbank.model.queries.Session import add [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 add [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_manager_projects

# 需要導入模塊: from cbank.model.queries import Session [as 別名]
# 或者: from cbank.model.queries.Session import add [as 別名]
 def test_manager_projects (self):
     project_1 = Mock(['id'])
     project_1.id = "1"
     project_2 = Mock(['id'])
     project_2.id = "2"
     resource = Mock(['id'])
     resource.id = "1"
     dt = datetime(2000, 1, 1)
     Session.add(Allocation(project_1, resource, 0, dt, dt))
     Session.add(Allocation(project_2, resource, 0, dt, dt))
     assert_equal(
         get_projects(manager=User.cached("1")),
         [Project.cached("1")])
開發者ID:anderbubble,項目名稱:cbank,代碼行數:15,代碼來源:test_queries.py

示例4: test_allocations

# 需要導入模塊: from cbank.model.queries import Session [as 別名]
# 或者: from cbank.model.queries.Session import add [as 別名]
 def test_allocations (self):
     project_1 = Mock(['id'])
     project_1.id = "1"
     project_2 = Mock(['id'])
     project_2.id = "2"
     resource = Mock(['id'])
     resource.id = "1"
     dt = datetime(2000, 1, 1)
     Session.add(Allocation(project_1, resource, 0, dt, dt))
     Session.add(Allocation(project_2, resource, 0, dt, dt))
     assert_equal(
         set(get_projects()),
         set([Project.cached("1"), Project.cached("2")]))
開發者ID:anderbubble,項目名稱:cbank,代碼行數:15,代碼來源:test_queries.py

示例5: test_charge_amount_negative

# 需要導入模塊: from cbank.model.queries import Session [as 別名]
# 或者: from cbank.model.queries.Session import add [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

示例6: test_hold_amount_negative

# 需要導入模塊: from cbank.model.queries import Session [as 別名]
# 或者: from cbank.model.queries.Session import add [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

示例7: test_allocation_amount_negative

# 需要導入模塊: from cbank.model.queries import Session [as 別名]
# 或者: from cbank.model.queries.Session import add [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.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。