fix MRO for multimethod.__call__ using iterative algorithm.
Add tests MRO for inherited multimethods with multiple inheritance Add tests for inherited and overridden multimethods
This commit is contained in:
committed by
Greg Becker
parent
43d94d4a30
commit
2621af41d1
@@ -124,4 +124,28 @@ def different_by_virtual_dep(self):
|
||||
#
|
||||
@when("@2:")
|
||||
def base_method(self):
|
||||
return "subclass_method"
|
||||
return 'multimethod'
|
||||
|
||||
#
|
||||
# Make sure methods with non-default implementations in a superclass
|
||||
# will invoke those methods when none in the subclass match but one in
|
||||
# the superclass does.
|
||||
#
|
||||
@when("@1.0")
|
||||
def inherited_and_overridden(self):
|
||||
return "base@1.0"
|
||||
|
||||
@when("@2.0")
|
||||
def inherited_and_overridden(self):
|
||||
return "base@2.0"
|
||||
|
||||
#
|
||||
# Make sure that multimethods follow MRO properly with diamond inheritance
|
||||
#
|
||||
@when('@2.0')
|
||||
def diamond_inheritance(self):
|
||||
return 'first_parent'
|
||||
|
||||
@when('@4.0')
|
||||
def diamond_inheritance(self):
|
||||
return "should_not_be_reached"
|
||||
|
||||
Reference in New Issue
Block a user