Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-92886: make test_multiprocessing pass with -O (assertions off) #98061

Closed
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
32 changes: 19 additions & 13 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5698,15 +5698,18 @@ def test_joinable_queue(self):

@classmethod
def _test_list(cls, obj):
assert obj[0] == 5
assert obj.count(5) == 1
assert obj.index(5) == 0
def check(a, b):
if a != b:
raise AssertionError(f"{a} != {b}")
check(obj[0], 5)
check(obj.count(5), 1)
check(obj.index(5), 0)
obj.sort()
obj.reverse()
for x in obj:
pass
assert len(obj) == 1
assert obj.pop(0) == 5
check(len(obj), 1)
check(obj.pop(0), 5)

def test_list(self):
o = self.manager.list()
Expand All @@ -5717,14 +5720,17 @@ def test_list(self):

@classmethod
def _test_dict(cls, obj):
assert len(obj) == 1
assert obj['foo'] == 5
assert obj.get('foo') == 5
assert list(obj.items()) == [('foo', 5)]
assert list(obj.keys()) == ['foo']
assert list(obj.values()) == [5]
assert obj.copy() == {'foo': 5}
assert obj.popitem() == ('foo', 5)
def check(a, b):
if a != b:
raise AssertionError(f"{a} != {b}")
check(len(obj), 1)
check(obj['foo'], 5)
check(obj.get('foo'), 5)
check(list(obj.items()), [('foo', 5)])
check(list(obj.keys()), ['foo'])
check(list(obj.values()), [5])
check(obj.copy(), {'foo': 5})
check(obj.popitem(), ('foo', 5))

def test_dict(self):
o = self.manager.dict()
Expand Down