Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions 17 Lib/sqlite3/test/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,23 @@ def trace(statement):
"Unicode data %s garbled in trace callback: %s"
% (ascii(unicode_value), ', '.join(map(ascii, traced_statements))))

def CheckTraceCallbackContent(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should skip the test if sqlite3_prepare_v2 is not available.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name doesn't explain what we actually testing here.

"""
Test that the statement are correct. Fix for bpo-26187

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring is not needed.

"""
con = sqlite.connect(":memory:")
traced_statements = []
def trace(statement):
traced_statements.append(statement)
con.set_trace_callback(trace)
queries = ["create table foo(x)", "insert into foo(x) values(1)"]
for query in queries:
con.execute(query)
con.commit()
queries.insert(1, "BEGIN ")
queries.append("COMMIT")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines can be removed. We only want to test that set_trace_callback doesn't produce any duplicate entries.

self.assertEqual(traced_statements, queries)



def suite():
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.