bpo-25130: Make SQLite tests more compatible with PyPy (GH-28021)

This commit is contained in:
Serhiy Storchaka 2021-08-29 13:07:40 +03:00 committed by GitHub
parent eb263f9a35
commit 07d3d54f4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -476,6 +476,9 @@ class CursorTests(unittest.TestCase):
def __init__(self): def __init__(self):
self.value = 5 self.value = 5
def __iter__(self):
return self
def __next__(self): def __next__(self):
if self.value == 10: if self.value == 10:
raise StopIteration raise StopIteration

View file

@ -126,11 +126,11 @@ class RegressionTests(unittest.TestCase):
con = sqlite.connect(":memory:",detect_types=sqlite.PARSE_DECLTYPES) con = sqlite.connect(":memory:",detect_types=sqlite.PARSE_DECLTYPES)
con.execute("create table foo(bar timestamp)") con.execute("create table foo(bar timestamp)")
con.execute("insert into foo(bar) values (?)", (datetime.datetime.now(),)) con.execute("insert into foo(bar) values (?)", (datetime.datetime.now(),))
con.execute(SELECT) con.execute(SELECT).close()
con.execute("drop table foo") con.execute("drop table foo")
con.execute("create table foo(bar integer)") con.execute("create table foo(bar integer)")
con.execute("insert into foo(bar) values (5)") con.execute("insert into foo(bar) values (5)")
con.execute(SELECT) con.execute(SELECT).close()
def test_bind_mutating_list(self): def test_bind_mutating_list(self):
# Issue41662: Crash when mutate a list of parameters during iteration. # Issue41662: Crash when mutate a list of parameters during iteration.