mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
The MRO conflict error message depends on dictionary hash order.
Avoid depending on this in the test.
This commit is contained in:
parent
4add68bbbc
commit
a01fa26396
1 changed files with 4 additions and 4 deletions
|
|
@ -1060,7 +1060,7 @@ def mro_disagreement():
|
||||||
try:
|
try:
|
||||||
callable(*args)
|
callable(*args)
|
||||||
except exc, msg:
|
except exc, msg:
|
||||||
if str(msg) != expected:
|
if not str(msg).startswith(expected):
|
||||||
raise TestFailed, "Message %r, expected %r" % (str(msg),
|
raise TestFailed, "Message %r, expected %r" % (str(msg),
|
||||||
expected)
|
expected)
|
||||||
else:
|
else:
|
||||||
|
|
@ -1071,9 +1071,9 @@ def mro_disagreement():
|
||||||
# Test some very simple errors
|
# Test some very simple errors
|
||||||
raises(TypeError, "duplicate base class A",
|
raises(TypeError, "duplicate base class A",
|
||||||
type, "X", (A, A), {})
|
type, "X", (A, A), {})
|
||||||
raises(TypeError, "MRO conflict among bases B, A",
|
raises(TypeError, "MRO conflict among bases ",
|
||||||
type, "X", (A, B), {})
|
type, "X", (A, B), {})
|
||||||
raises(TypeError, "MRO conflict among bases C, B, A",
|
raises(TypeError, "MRO conflict among bases ",
|
||||||
type, "X", (A, C, B), {})
|
type, "X", (A, C, B), {})
|
||||||
# Test a slightly more complex error
|
# Test a slightly more complex error
|
||||||
class GridLayout(object): pass
|
class GridLayout(object): pass
|
||||||
|
|
@ -1081,7 +1081,7 @@ def mro_disagreement():
|
||||||
class VerticalGrid(GridLayout): pass
|
class VerticalGrid(GridLayout): pass
|
||||||
class HVGrid(HorizontalGrid, VerticalGrid): pass
|
class HVGrid(HorizontalGrid, VerticalGrid): pass
|
||||||
class VHGrid(VerticalGrid, HorizontalGrid): pass
|
class VHGrid(VerticalGrid, HorizontalGrid): pass
|
||||||
raises(TypeError, "MRO conflict among bases VerticalGrid, HorizontalGrid",
|
raises(TypeError, "MRO conflict among bases ",
|
||||||
type, "ConfusedGrid", (HVGrid, VHGrid), {})
|
type, "ConfusedGrid", (HVGrid, VHGrid), {})
|
||||||
|
|
||||||
def objects():
|
def objects():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue