Feat: test random import
This commit is contained in:
parent
b43c64fc7e
commit
32112a4591
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from .calculus import Expression, Integer, Decimal, render, Polynomial, Fraction#, random_list,
|
from .calculus import Expression, render, random
|
||||||
|
|
||||||
# Expression.set_render('tex')
|
# Expression.set_render('tex')
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ Make calculus as a student
|
|||||||
|
|
||||||
Expression is the classe wich handle all calculus. It can randomly generate or import calculus, simplify them and explain them as a student would do.
|
Expression is the classe wich handle all calculus. It can randomly generate or import calculus, simplify them and explain them as a student would do.
|
||||||
|
|
||||||
>>> from mapytex.calculus import Expression
|
|
||||||
>>> render.set_render("txt")
|
>>> render.set_render("txt")
|
||||||
>>> e = Expression.from_str("2x + 6 - 3x")
|
>>> e = Expression.from_str("2x + 6 - 3x")
|
||||||
>>> print(e)
|
>>> print(e)
|
||||||
@ -27,16 +26,23 @@ Expression is the classe wich handle all calculus. It can randomly generate or i
|
|||||||
(2 - 3) * x + 6
|
(2 - 3) * x + 6
|
||||||
- x + 6
|
- x + 6
|
||||||
|
|
||||||
|
Create random Expression
|
||||||
|
========================
|
||||||
|
|
||||||
|
>>> e = random.expression("{a} / {b} + {c} / {d}")
|
||||||
|
>>> print(e) # doctest: +SKIP
|
||||||
|
- 3 / - 10 + 3 / 5
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .API import Expression, Integer, Decimal, render, Polynomial, Fraction
|
from .API import render, Expression
|
||||||
#from .core import random_list
|
#from decimal import getcontext
|
||||||
from decimal import getcontext
|
from . import random
|
||||||
|
|
||||||
#getcontext().prec = 2
|
#getcontext().prec = 2
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["Expression"]
|
__all__ = ["render", "Expression", "random"]
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
from .list import list_generator as list
|
||||||
|
from .expression import expression_generator as expression
|
||||||
|
|
||||||
|
__all__ = ["list", "expression"]
|
||||||
|
|
||||||
|
"""
|
||||||
|
Generate random stuffs
|
||||||
|
======================
|
||||||
|
|
||||||
|
list_generator
|
||||||
|
==============
|
||||||
|
|
||||||
|
Generate random lists
|
||||||
|
|
||||||
|
expression_generator
|
||||||
|
====================
|
||||||
|
|
||||||
|
Generate random Expression
|
||||||
|
"""
|
@ -1,6 +0,0 @@
|
|||||||
import pytest
|
|
||||||
import mapytex
|
|
||||||
|
|
||||||
def test_random_function():
|
|
||||||
assert 1 == 1
|
|
||||||
#mapytex.random("{a}")
|
|
@ -17,7 +17,7 @@ def test_changing_render():
|
|||||||
|
|
||||||
def test_changing_rending():
|
def test_changing_rending():
|
||||||
e = mapytex.Expression.from_str("2*3")
|
e = mapytex.Expression.from_str("2*3")
|
||||||
f = mapytex.Fraction("2/3")
|
f = mapytex.Expression.from_str("2/3")
|
||||||
assert str(e) == "2 * 3"
|
assert str(e) == "2 * 3"
|
||||||
assert str(f) == "2 / 3"
|
assert str(f) == "2 / 3"
|
||||||
mapytex.render.set_render("tex")
|
mapytex.render.set_render("tex")
|
||||||
|
4
test/calculus/random/test_list_generator.py
Normal file
4
test/calculus/random/test_list_generator.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import mapytex
|
||||||
|
|
||||||
|
def test_generate_list():
|
||||||
|
mapytex.random.list(["a", "b", "c"])
|
Loading…
Reference in New Issue
Block a user