From b072c9b457d04347f21ed86a15f7da618fd9027d Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Wed, 5 Dec 2018 20:12:47 -0800 Subject: multimethod: slight refactoring, documentation for code review --- .../packages/multimethod-diamond-parent/package.py | 2 +- .../builtin.mock/packages/multimethod/package.py | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py b/var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py index d3413a36b5..e10e5497af 100644 --- a/var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py +++ b/var/spack/repos/builtin.mock/packages/multimethod-diamond-parent/package.py @@ -18,4 +18,4 @@ class MultimethodDiamondParent(MultimethodBase): @when('@4.0, 2.0') def diamond_inheritance(self): - return "should never be reached" + return "should never be reached by diamond inheritance test" diff --git a/var/spack/repos/builtin.mock/packages/multimethod/package.py b/var/spack/repos/builtin.mock/packages/multimethod/package.py index 738e41be41..558d99717f 100644 --- a/var/spack/repos/builtin.mock/packages/multimethod/package.py +++ b/var/spack/repos/builtin.mock/packages/multimethod/package.py @@ -148,4 +148,23 @@ class Multimethod(MultimethodBase): @when('@4.0') def diamond_inheritance(self): - return "should_not_be_reached" + return "should_not_be_reached by diamond inheritance test" + + # + # Check that multimethods work with boolean values + # + @when(True) + def boolean_true_first(self): + return 'True' + + @when(False) + def boolean_true_first(self): + return 'False' + + @when(False) + def boolean_false_first(self): + return 'False' + + @when(True) + def boolean_false_first(self): + return 'True' -- cgit v1.2.3-70-g09d2