Commit d5d8e4a4 authored by Guido van Rossum's avatar Guido van Rossum

Enable two checks for comparing a complex to a complex subtype

instance.

Split a string comparison test in two halves, replacing "a==b==a" with
separate tests for a==b and b==a.  (Reason: while experimenting, this
test failed, and I wanted to know if it was the first or the second ==
operator that failed.)
parent 63805960
...@@ -1492,12 +1492,12 @@ def inherits(): ...@@ -1492,12 +1492,12 @@ def inherits():
verify(repr(a) == "4j-3") verify(repr(a) == "4j-3")
base = complex(-3, 4) base = complex(-3, 4)
verify(base.__class__ is complex) verify(base.__class__ is complex)
#XXX verify(a == base) verify(a == base)
verify(complex(a) == base) verify(complex(a) == base)
verify(complex(a).__class__ is complex) verify(complex(a).__class__ is complex)
a = madcomplex(a) # just trying another form of the constructor a = madcomplex(a) # just trying another form of the constructor
verify(repr(a) == "4j-3") verify(repr(a) == "4j-3")
#XXX verify(a == base) verify(a == base)
verify(complex(a) == base) verify(complex(a) == base)
verify(complex(a).__class__ is complex) verify(complex(a).__class__ is complex)
verify(hash(a) == hash(base)) verify(hash(a) == hash(base))
...@@ -1821,7 +1821,8 @@ def str_subclass_as_dict_key(): ...@@ -1821,7 +1821,8 @@ def str_subclass_as_dict_key():
def __hash__(self): def __hash__(self):
return self.hashcode return self.hashcode
verify('aBc' == cistr('ABC') == 'abc') verify(cistr('ABC') == 'abc')
verify('aBc' == cistr('ABC'))
verify(str(cistr('ABC')) == 'ABC') verify(str(cistr('ABC')) == 'ABC')
d = {cistr('one'): 1, cistr('two'): 2, cistr('tHree'): 3} d = {cistr('one'): 1, cistr('two'): 2, cistr('tHree'): 3}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment