Commit 544f0483 authored by Louis's avatar Louis
Browse files

L'identifiant des exercices n'inclue plus son module

parent bee70ce0
......@@ -47,9 +47,8 @@ Description des exercices
=========================
Les exercices sur lesquels s'appliquent les commandes de ``pyromaths-cli`` sont
décrits comme ``quatriemes.exo_pythagore:4,6``, où :
décrits comme ``exo_pythagore:4,6``, où :
* ``quatriemes`` est le niveau de l'exercice ;
* ``exo_pythagore`` est l'identifiant de l'exercice (le nom de la fonction ou
de la classe qui le définit) ;
* ``4,6`` sont les graines du générateur
......
......@@ -148,8 +148,8 @@ def do_generate(options):
def do_ls(options): # pylint: disable=unused-argument
"""Perform the `ls` command."""
tests = TestPerformer()
for exo_id in tests.iter_id():
print(exo_id) # pylint: disable=superfluous-parens
for name in sorted(tests.iter_names()):
print(name) # pylint: disable=superfluous-parens
COMMANDS = {
"generate": do_generate,
......
......@@ -189,7 +189,7 @@ def get_exercise_list_or_all(tests, exercise_option):
else:
exercise_list = [
(exo, tests.get_tested_seeds(exo))
for exo in tests.iter_id()
for exo in tests.iter_names()
]
return exercise_list
......
......@@ -26,13 +26,6 @@ class TexExercise(Exercise):
from pyromaths.Values import data_dir
return os.path.join(data_dir(), 'ex', cls.dirlevel, 'img', "%s.png" % cls.name())
@classmethod
def id(cls):
return "{}.{}".format(
cls.dirlevel,
cls.name(),
)
def tex_statement(self):
''' Return problem statement in TeX format. '''
raise NotImplementedError()
......
......@@ -184,7 +184,7 @@ class UnittestExercise(unittest.TestCase):
if self.exercise is None:
return super(UnittestExercise, self).shortDescription()
else:
return self.exercise.exercise.id()
return self.exercise.exercise.name()
def runTest(self):
"""Perform test"""
......@@ -208,10 +208,10 @@ class TestPerformer(object):
levels = pyromaths.ex.load_levels()
for level in levels:
for exercise in levels[level]:
self.exercises[exercise.id()] = exercise
self.exercises[exercise.name()] = exercise
def iter_id(self):
"""Iterate over exercise ids."""
def iter_names(self):
"""Iterate over exercise names."""
return self.exercises.keys()
def get(self, exercise, seed):
......
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