本文整理匯總了Python中explorer.tests.factories.SimpleQueryFactory.log方法的典型用法代碼示例。如果您正苦於以下問題:Python SimpleQueryFactory.log方法的具體用法?Python SimpleQueryFactory.log怎麽用?Python SimpleQueryFactory.log使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類explorer.tests.factories.SimpleQueryFactory
的用法示例。
在下文中一共展示了SimpleQueryFactory.log方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_run_count
# 需要導入模塊: from explorer.tests.factories import SimpleQueryFactory [as 別名]
# 或者: from explorer.tests.factories.SimpleQueryFactory import log [as 別名]
def test_get_run_count(self):
q = SimpleQueryFactory()
self.assertEqual(q.get_run_count(), 0)
expected = 4
for i in range(0, expected):
q.log()
self.assertEqual(q.get_run_count(), expected)
示例2: test_query_logs_final_sql
# 需要導入模塊: from explorer.tests.factories import SimpleQueryFactory [as 別名]
# 或者: from explorer.tests.factories.SimpleQueryFactory import log [as 別名]
def test_query_logs_final_sql(self):
q = SimpleQueryFactory(sql="select '$$foo$$';")
q.params = {'foo': 'bar'}
q.log(None)
self.assertEqual(1, QueryLog.objects.count())
log = QueryLog.objects.first()
self.assertEqual(log.sql, "select 'bar';")
示例3: test_query_log
# 需要導入模塊: from explorer.tests.factories import SimpleQueryFactory [as 別名]
# 或者: from explorer.tests.factories.SimpleQueryFactory import log [as 別名]
def test_query_log(self):
self.assertEqual(0, QueryLog.objects.count())
q = SimpleQueryFactory()
q.log(None)
self.assertEqual(1, QueryLog.objects.count())
log = QueryLog.objects.first()
self.assertEqual(log.run_by_user, None)
self.assertEqual(log.query, q)
self.assertFalse(log.is_playground)
示例4: test_avg_duration
# 需要導入模塊: from explorer.tests.factories import SimpleQueryFactory [as 別名]
# 或者: from explorer.tests.factories.SimpleQueryFactory import log [as 別名]
def test_avg_duration(self):
q = SimpleQueryFactory()
self.assertIsNone(q.avg_duration())
expected = 2.5
ql = q.log()
ql.duration = 2
ql.save()
ql = q.log()
ql.duration = 3
ql.save()
self.assertEqual(q.avg_duration(), expected)
示例5: test_run_count
# 需要導入模塊: from explorer.tests.factories import SimpleQueryFactory [as 別名]
# 或者: from explorer.tests.factories.SimpleQueryFactory import log [as 別名]
def test_run_count(self):
q = SimpleQueryFactory(title='foo - bar1')
for i in range(0, 4):
q.log()
resp = self.client.get(reverse("explorer_index"))
self.assertContains(resp, '<td>4</td>')