Move MOError to exceptions.py

This commit is contained in:
Bertrand Benjamin 2018-03-14 11:04:13 +03:00
parent d1c6e2d3da
commit eff438b930
2 changed files with 8 additions and 7 deletions

View File

@ -10,6 +10,9 @@
Exceptions for core tools Exceptions for core tools
""" """
class MOError(Exception):
pass
# ----------------------------- # -----------------------------
# Reglages pour 'vim' # Reglages pour 'vim'

View File

@ -7,15 +7,13 @@
# Distributed under terms of the MIT license. # Distributed under terms of the MIT license.
from decimal import Decimal from decimal import Decimal
from .exceptions import MOError
from ..coroutine import coroutine, STOOOP from ..coroutine import coroutine, STOOOP
from ..renders import tree2txt, tree2tex from ..renders import tree2txt, tree2tex
__all__ = ["moify", "MO", "MOstr"] __all__ = ["moify", "MO", "MOstr"]
class MOError(Exception):
pass
@coroutine @coroutine
def moify(target): def moify(target):
""" Coroutine which try to convert everything into an MO """ """ Coroutine which try to convert everything into an MO """
@ -125,7 +123,7 @@ class MOnumber(MO):
>>> MOnumber("a") >>> MOnumber("a")
Traceback (most recent call last): Traceback (most recent call last):
... ...
mapytex.calculus.core.MO.mo.MOError: The value of an MOnumber need to be a int, a float or a Decimal mapytex.calculus.core.MO.exceptions.MOError: The value of an MOnumber need to be a int, a float or a Decimal
""" """
try: try:
@ -293,15 +291,15 @@ class MOstr(MO):
>>> a = MOstr("+") >>> a = MOstr("+")
Traceback (most recent call last): Traceback (most recent call last):
... ...
mapytex.calculus.core.MO.mo.MOError: An MOstr should be initiate with a alpha string, got + mapytex.calculus.core.MO.exceptions.MOError: An MOstr should be initiate with a alpha string, got +
>>> MOstr("ui") >>> MOstr("ui")
Traceback (most recent call last): Traceback (most recent call last):
... ...
mapytex.calculus.core.MO.mo.MOError: An MOstr should be initiate with a single caracter string, got ui mapytex.calculus.core.MO.exceptions.MOError: An MOstr should be initiate with a single caracter string, got ui
>>> MOstr(2) >>> MOstr(2)
Traceback (most recent call last): Traceback (most recent call last):
... ...
mapytex.calculus.core.MO.mo.MOError: An MOstr should be initiate with a string - the unknown, got 2 mapytex.calculus.core.MO.exceptions.MOError: An MOstr should be initiate with a string - the unknown, got 2
""" """
try: try: