Skip to content

Commit

Permalink
pythongh-92886: make test_multiprocessing pass with -O (assertions off)
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel committed Oct 7, 2022
1 parent be4099e commit f46e251
Showing 1 changed file with 19 additions and 13 deletions.
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

0 comments on commit f46e251

Please sign in to comment.