diff --git a/SYMBOLS_MANIFEST.txt b/SYMBOLS_MANIFEST.txt index 8380e82db..4918d70c0 100644 --- a/SYMBOLS_MANIFEST.txt +++ b/SYMBOLS_MANIFEST.txt @@ -1132,7 +1132,7 @@ System`Sow System`Span System`SparseArray System`Sphere -System`Sphere3DBox +System`SphereBox System`SphericalBesselJ System`SphericalBesselY System`SphericalHankelH1 diff --git a/mathics/builtin/box/graphics3d.py b/mathics/builtin/box/graphics3d.py index ab6f33cb1..b362a94a4 100644 --- a/mathics/builtin/box/graphics3d.py +++ b/mathics/builtin/box/graphics3d.py @@ -271,7 +271,7 @@ def _apply_boxscaling(self, boxscale): coords.scale(boxscale) -class Sphere3DBox(GraphicsElementBox): +class SphereBox(GraphicsElementBox): # summary_text = "box representation for a sphere" # We have no documentation for this (yet). @@ -359,7 +359,7 @@ def _apply_boxscaling(self, boxscale): Symbol("Line3DBox"): Line3DBox, Symbol("Point3DBox"): Point3DBox, Symbol("Polygon3DBox"): Polygon3DBox, - Symbol("Sphere3DBox"): Sphere3DBox, + Symbol("SphereBox"): SphereBox, Symbol("Tube3DBox"): Tube3DBox, } ) diff --git a/mathics/builtin/drawing/graphics3d.py b/mathics/builtin/drawing/graphics3d.py index e384d476f..73cf69f62 100644 --- a/mathics/builtin/drawing/graphics3d.py +++ b/mathics/builtin/drawing/graphics3d.py @@ -88,7 +88,7 @@ class Graphics3D(Graphics): . size(6.6667cm, 6.6667cm); . currentprojection=perspective(2.6,-4.8,4.0); . currentlight=light(rgb(0.5,0.5,0.5), specular=red, (2,0,2), (2,2,2), (0,2,2)); - . // Sphere3DBox + . // SphereBox . draw(surface(sphere((0, 0, 0), 1)), rgb(1,1,1)+opacity(1)); . draw(((-1,-1,-1)--(1,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1)); . draw(((-1,1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1)); @@ -130,7 +130,7 @@ class Graphics3D(Graphics): "ViewProjection": "Automatic", "ViewRange": "All", "ViewVector": "Automatic", - "ViewVertical": "{0,0,1}", + "ViewVertical": "{0.,0.,1.}", } ) diff --git a/mathics/core/systemsymbols.py b/mathics/core/systemsymbols.py index cfbd92b87..9309b0a4a 100644 --- a/mathics/core/systemsymbols.py +++ b/mathics/core/systemsymbols.py @@ -348,6 +348,8 @@ SymbolSortBy: Final[Symbol] = Symbol("System`SortBy") SymbolSpan: Final[Symbol] = Symbol("System`Span") SymbolSparseArray: Final[Symbol] = Symbol("System`SparseArray") +SymbolSphere: Final[Symbol] = Symbol("System`Sphere") +SymbolSphereBox: Final[Symbol] = Symbol("System`SphereBox") SymbolSphericalRegion: Final[Symbol] = Symbol("System`SphericalRegion") SymbolSplit: Final[Symbol] = Symbol("System`Split") SymbolSqrt: Final[Symbol] = Symbol("System`Sqrt") diff --git a/mathics/doc/latex/testing-sample.tex b/mathics/doc/latex/testing-sample.tex index d2231553e..24716f925 100644 --- a/mathics/doc/latex/testing-sample.tex +++ b/mathics/doc/latex/testing-sample.tex @@ -31,7 +31,7 @@ \section*{TestSection} size(6.6667cm, 6.6667cm); currentprojection=perspective(2.6,-4.8,4.0); currentlight=light(rgb(0.5,0.5,0.5), specular=red, (2,0,2), (2,2,2), (0,2,2)); -// Sphere3DBox +// SphereBox draw(surface(sphere((0, 0, 0), 1)), rgb(0.0,0.6666666666666667,0.0)); draw(((-1,-1,-1)--(1,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1)); draw(((-1,1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1)); diff --git a/mathics/eval/options/values.py b/mathics/eval/options/values.py index c59c97756..220361bff 100644 --- a/mathics/eval/options/values.py +++ b/mathics/eval/options/values.py @@ -1,5 +1,5 @@ from mathics.core.parser import parse_builtin_rule -from mathics.core.symbols import SymbolList, strip_context +from mathics.core.symbols import strip_context def filter_non_default_values(builtin): diff --git a/mathics/format/box/graphics.py b/mathics/format/box/graphics.py index 20a345ed6..edb698374 100644 --- a/mathics/format/box/graphics.py +++ b/mathics/format/box/graphics.py @@ -39,6 +39,8 @@ SymbolGraphics, SymbolInset, SymbolOffset, + SymbolSphere, + SymbolSphereBox, SymbolStyle, SymbolText, ) @@ -956,6 +958,9 @@ def primitives_to_boxes( ], ) + # Sphere-> SphereBox, no Sphere3DBox... + if head is SymbolSphere: + return Expression(SymbolSphereBox, *content.elements) if head in ELEMENT_HEADS: if head is SymbolText: head = SymbolInset diff --git a/mathics/format/render/asy.py b/mathics/format/render/asy.py index 28f479470..4b0e12bfb 100644 --- a/mathics/format/render/asy.py +++ b/mathics/format/render/asy.py @@ -26,7 +26,7 @@ Line3DBox, Point3DBox, Polygon3DBox, - Sphere3DBox, + SphereBox, Tube3DBox, ) from mathics.builtin.box.uniform_polyhedra import UniformPolyhedron3DBox @@ -700,14 +700,14 @@ def roundbox(box: RoundBox): add_render_function(RoundBox) -def sphere3dbox(box: Sphere3DBox, **options) -> str: +def spherebox(box: SphereBox, **options) -> str: # l = box.style.get_line_width(face_element=True) face_color = box.face_color.to_js() if box.face_color else (1, 1, 1) opacity = box.face_opacity color_str = build_3d_pen_color(face_color, opacity) - return "// Sphere3DBox\n" + "\n".join( + return "// SphereBox\n" + "\n".join( "draw(surface(sphere({0}, {1})), {2});".format( tuple(coord.pos()[0]), box.radius, color_str ) @@ -715,7 +715,7 @@ def sphere3dbox(box: Sphere3DBox, **options) -> str: ) -add_render_function(Sphere3DBox) +add_render_function(SphereBox) def tube_3d_box(box: Tube3DBox, **options) -> str: diff --git a/mathics/format/render/json.py b/mathics/format/render/json.py index 8ffff74ed..e08d2b05c 100644 --- a/mathics/format/render/json.py +++ b/mathics/format/render/json.py @@ -15,7 +15,7 @@ Line3DBox, Point3DBox, Polygon3DBox, - Sphere3DBox, + SphereBox, Tube3DBox, ) from mathics.builtin.box.uniform_polyhedra import UniformPolyhedron3DBox @@ -271,7 +271,7 @@ def polygon_3d_box(box: Polygon3DBox) -> list: add_render_function(Polygon3DBox, polygon_3d_box) -def sphere_3d_box(box: Sphere3DBox) -> list: +def sphere_3d_box(box: SphereBox) -> list: face_color = box.face_color.to_js() if len(face_color) < 4 and box.face_opacity: face_color = face_color + [box.face_opacity.opacity] @@ -281,11 +281,11 @@ def sphere_3d_box(box: Sphere3DBox) -> list: face_color, {"radius": box.radius}, ) - # print("### json Sphere3DBox", data) + # print("### json SphereBox", data) return data -add_render_function(Sphere3DBox, sphere_3d_box) +add_render_function(SphereBox, sphere_3d_box) def uniform_polyhedron_3d_box(box: UniformPolyhedron3DBox) -> list: diff --git a/test/builtin/assumptions/test_assumptions.py b/test/builtin/assumptions/test_assumptions.py index e331af528..bde383848 100644 --- a/test/builtin/assumptions/test_assumptions.py +++ b/test/builtin/assumptions/test_assumptions.py @@ -152,7 +152,7 @@ def test_assumptions_integrate(str_expr, str_expected, message): LIST_TEST_ASSUMPTIONS_INTEGRATE_FAILING, ) @pytest.mark.xfail(reason="the Assumptions with Integrate is not fully working") -def test_assumptions_integrate(str_expr, str_expected, message): +def test_assumptions_integrate2(str_expr, str_expected, message): check_evaluation(str_expr, str_expected) diff --git a/test/builtin/drawing/test_plot.py b/test/builtin/drawing/test_plot.py index c293cab30..db7fced86 100644 --- a/test/builtin/drawing/test_plot.py +++ b/test/builtin/drawing/test_plot.py @@ -184,7 +184,7 @@ def test__listplot(): "size(6.6667cm, 6.6667cm);\n" "currentprojection=perspective(2.6,-4.8,4.0);\n" "currentlight=light(rgb(0.5,0.5,0.5), background=rgb(1, 0.1, 0.1), specular=red, (2,0,2), (2,2,2), (0,2,2));\n" - "// Sphere3DBox\n" + "// SphereBox\n" "draw(surface(sphere((0, 0, 0), 1)), rgb(1,1,1)+opacity(1));\n" "draw(((-1,-1,-1)--(1,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));\n" "draw(((-1,1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));\n" diff --git a/test/core/convert/test_sympy.py b/test/core/convert/test_sympy.py index ce1117838..35df0c7c2 100644 --- a/test/core/convert/test_sympy.py +++ b/test/core/convert/test_sympy.py @@ -39,16 +39,7 @@ Symbol_F = Symbol("Global`F") Symbol_G = Symbol("Global`G") -from mathics.core.expression import Expression -from mathics.core.expression_predefined import MATHICS3_COMPLEX_INFINITY -from mathics.core.symbols import ( - Symbol, - SymbolNull, - SymbolPlus, - SymbolPower, - SymbolTimes, -) -from mathics.core.systemsymbols import SymbolE, SymbolExp, SymbolI, SymbolPi, SymbolSin +from mathics.core.symbols import Symbol Symbol_a = Symbol("Global`a") Symbol_b = Symbol("Global`b") diff --git a/test/format/test_makeboxes.py b/test/format/test_makeboxes.py index 1626df519..8925fada3 100644 --- a/test/format/test_makeboxes.py +++ b/test/format/test_makeboxes.py @@ -88,7 +88,6 @@ def test_makeboxes_precedence(str_expr, str_expected, msg): ("str_expr", "str_expected", "msg"), list(makeboxes_basic_forms_iterator("Graphics")), ) -@skip_or_fail def test_makeboxes_graphics(str_expr, str_expected, msg): """ # TODO: Constructing boxes from Real which are currently failing @@ -231,7 +230,6 @@ def test_makeboxes_others_fail(str_expr, str_expected, msg): ), ], ) -@skip_or_fail def test_makeboxes_custom(str_expr, str_expected, msg): """ These tests checks the behaviour of MakeBoxes. diff --git a/test/timings/test_regressions.py b/test/timings/test_regressions.py index 096000980..968e84e66 100644 --- a/test/timings/test_regressions.py +++ b/test/timings/test_regressions.py @@ -152,9 +152,6 @@ param_ids = [name for name, _, _, _ in BENCHMARK_TASKS] -import pytest - - @pytest.mark.skipif( not os.environ.get("BENCHMARKS", 0), reason="benchmarks not required" )