diff --git a/mathics/builtin/files_io/importexport.py b/mathics/builtin/files_io/importexport.py index 82447ecd2..8f70ca7f3 100644 --- a/mathics/builtin/files_io/importexport.py +++ b/mathics/builtin/files_io/importexport.py @@ -1298,8 +1298,6 @@ class Import(Builtin): = ... #> Import["ExampleData/Middlemarch.txt"]; : An invalid unicode sequence was encountered and ignored. - #> StringTake[Import["ExampleData/Middlemarch.txt", CharacterEncoding -> "ISO8859-1"], {21, 69}] - = Le sentiment de la fausseté des plaisirs présents ## JSON >> Import["ExampleData/colors.json"] diff --git a/mathics/builtin/optimization.py b/mathics/builtin/optimization.py index c153d9e0d..51c15c36b 100644 --- a/mathics/builtin/optimization.py +++ b/mathics/builtin/optimization.py @@ -10,9 +10,8 @@ from mathics.version import __version__ # noqa used in loading to check consistency. from mathics.builtin.base import Builtin -from mathics.core.expression import Expression, Integer, Number, from_python -from mathics.core.convert import sympy_symbol_prefix, SympyExpression, from_sympy -from mathics.core.rules import Pattern +from mathics.core.expression import Expression, from_python +from mathics.core.convert import from_sympy import sympy diff --git a/mathics/builtin/tensors.py b/mathics/builtin/tensors.py index e2e85bc1b..c411d2855 100644 --- a/mathics/builtin/tensors.py +++ b/mathics/builtin/tensors.py @@ -6,6 +6,8 @@ In mathematics, a tensor is an algebraic object that describes a (multilinear) relationship between sets of algebraic objects related to a vector space. Objects that tensors may map between include vectors and scalars, and even other tensors. There are many types of tensors, including scalars and vectors (which are the simplest tensors), dual vectors, multilinear maps between vector spaces, and even some operations such as the dot product. Tensors are defined independent of any basis, although they are often referred to by their components in a basis related to a particular coordinate system. + +Mathics represents tensors of vectors and matrices as lists; tensors of any rank can be handled. """ from mathics.version import __version__ # noqa used in loading to check consistency. diff --git a/mathics/docpipeline.py b/mathics/docpipeline.py index 57ecda197..2f0337698 100644 --- a/mathics/docpipeline.py +++ b/mathics/docpipeline.py @@ -88,7 +88,10 @@ def fail(why): f"""{sep}Test failed: {section} in {part} / {chapter} {part} n{why} -""".encode("utf-8")) +""".encode( + "utf-8" + ) + ) return False if not quiet: diff --git a/test/test_importexport.py b/test/test_importexport.py new file mode 100644 index 000000000..0c9c04e9e --- /dev/null +++ b/test/test_importexport.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +from .helper import check_evaluation + + +def test_import(): + eaccent = "\xe9" + for str_expr, str_expected, message in ( + ( + """StringTake[Import["ExampleData/Middlemarch.txt", CharacterEncoding -> "ISO8859-1"], {49, 69}]""", + f"des plaisirs pr{eaccent}sents", + "accented characters in Import" + ), + ): + check_evaluation(str_expr, str_expected, message)