Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
sage.features.rubiks: Make .name lowercase to match optional tag; ref…
Browse files Browse the repository at this point in the history
…actor through JoinFeature
  • Loading branch information
Matthias Koeppe committed Oct 7, 2021
1 parent eb8f637 commit 0c012f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/sage/doctest/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def has_rubiks():
sage: from sage.doctest.external import has_rubiks
sage: has_rubiks() # optional -- rubiks
FeatureTestResult('Rubiks', True)
FeatureTestResult('rubiks', True)
"""
from sage.features.rubiks import Rubiks
return Rubiks().is_present()
Expand Down
30 changes: 7 additions & 23 deletions src/sage/features/rubiks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# https://www.gnu.org/licenses/
# ****************************************************************************
from . import Feature, Executable, FeatureTestResult
from .join_feature import JoinFeature


class cu2(Executable):
r"""
Expand Down Expand Up @@ -149,7 +151,7 @@ def __init__(self):
spkg="rubiks")


class Rubiks(Feature):
class Rubiks(JoinFeature):
r"""
A :class:`sage.features.Feature` describing the presence of
``cu2``, ``cubex``, ``dikcube``, ``mcube``, ``optimal``, and
Expand All @@ -159,7 +161,7 @@ class Rubiks(Feature):
sage: from sage.features.rubiks import Rubiks
sage: Rubiks().is_present() # optional: rubiks
FeatureTestResult('Rubiks', True)
FeatureTestResult('rubiks', True)
"""
def __init__(self):
r"""
Expand All @@ -169,24 +171,6 @@ def __init__(self):
sage: isinstance(Rubiks(), Rubiks)
True
"""
Feature.__init__(self, "Rubiks",
spkg="rubiks")

def _is_present(self):
r"""
EXAMPLES::
sage: from sage.features.rubiks import Rubiks
sage: Rubiks()._is_present() # optional: rubiks
FeatureTestResult('Rubiks', True)
"""
test = (cu2()._is_present() and
size222()._is_present() and
optimal()._is_present() and
mcube()._is_present() and
dikcube()._is_present() and
cubex()._is_present())
if not test:
return test
else:
return FeatureTestResult(self, True)
JoinFeature.__init__(self, "rubiks",
[cu2(), size222(), optimal(), mcube(), dikcube(), cubex()]
spkg="rubiks")

0 comments on commit 0c012f7

Please sign in to comment.