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


Python DbClient._getInboxTable方法代碼示例

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


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

示例1: testConversationIdsFromParent

# 需要導入模塊: from dbclient import DbClient [as 別名]
# 或者: from dbclient.DbClient import _getInboxTable [as 別名]
	def testConversationIdsFromParent(self):
		'''Check that the correct conversation id can be found based on a parent hash'''
		startId = DbClient.getNewConversationId()
		# Does it work on an empty inbox?
		DbClient._getInboxTable().remove()
		nextId = DbClient.getConversationId("some random hash")
		self.assertEqual(startId+1, nextId, "Should increment if hash not found in empty inbox")
		nextId = DbClient.getConversationId(None)
		self.assertEqual(startId+2, nextId, "Should increment if None hash given")
		nextId = DbClient.getConversationId("")
		self.assertEqual(startId+3, nextId, "Should increment if empty string hash given")
		# Now add a message with a hash
		rowToStore = {"messageType":"normal", "fromId":"BCD123EFG456HI78", "timestamp":"2012-01-08-13-18",
			"messageBody":"I do like a day beside the seaside", "recipients":"ABC123DEF456GH78"}
		DbClient.addMessageToInbox(rowToStore)
		nextId = DbClient.getConversationId("some random hash")
		self.assertEqual(startId+5, nextId, "Should increment if hash not found in inbox")
		nextId = DbClient.getConversationId("7b6dd00818a70515ba560efc5a42aab5")
		self.assertEqual(startId+4, nextId, "Should take the old id if hash was found in inbox")
		anotherId = DbClient.getConversationId("7b6dd00818a70515ba560efc5a42aab5")
		self.assertEqual(anotherId, nextId, "Should reuse the same id if hash was found in inbox")
開發者ID:activityworkshop,項目名稱:Murmeli,代碼行數:23,代碼來源:databasetest.py


注:本文中的dbclient.DbClient._getInboxTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。