コード例 #1
0
ファイル: test_dbkit.py プロジェクト: justinfay/dbkit
 def test_logging(self):
     with dbkit.connect(sqlite3, ':memory:') as ctx:
         captured = six.StringIO()
         ctx.logger = dbkit.make_file_object_logger(captured)
         dbkit.query_column(LIST_TABLES)
     value = utils.skip_first_line(captured.getvalue())
     captured.close()
     self.assertEqual(value, "%s\nArguments:\n()\n" % (LIST_TABLES,))
コード例 #2
0
ファイル: test_dbkit.py プロジェクト: justinfay/dbkit
 def test_make_file_object_logger(self):
     captured = six.StringIO()
     logger = dbkit.make_file_object_logger(captured)
     logger("STATEMENT", (23, 42))
     # When we get the value, we want to skip the first line, which changes
     # with every call as it contains a date.
     value = utils.skip_first_line(captured.getvalue())
     captured.close()
     self.assertEqual(value, "STATEMENT\nArguments:\n(23, 42)\n")