Skip to content

Commit fbfee4e

Browse files
committed
Pass **kwargs for encoding
Also, add CharacterEncoding="ASCII" in test helper
1 parent 40650a0 commit fbfee4e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

mathics/format/box/makeboxes.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ def eval_makeboxes_traditional_form(expr, evaluation):
7676

7777

7878
def apply_makeboxes_rules(
79-
expr: BaseElement, evaluation: Evaluation, form: Symbol = SymbolStandardForm
79+
expr: BaseElement,
80+
evaluation: Evaluation,
81+
form: Symbol = SymbolStandardForm,
82+
**kwargs,
8083
) -> BoxElementMixin:
8184
"""
8285
This function takes the definitions provided by the evaluation
@@ -124,7 +127,7 @@ def yield_rules():
124127
if parent_form is not form:
125128
return apply_makeboxes_rules(expr, evaluation, parent_form)
126129

127-
return eval_generic_makeboxes(expr, form, evaluation)
130+
return eval_generic_makeboxes(expr, form, evaluation, **kwargs)
128131

129132

130133
# TODO: evaluation is needed because `atom_to_boxes` uses it. Can we remove this
@@ -205,7 +208,7 @@ def eval_makeboxes_fullform_recursive(
205208
return RowBox(*result_elements)
206209

207210

208-
def eval_generic_makeboxes(expr, f, evaluation):
211+
def eval_generic_makeboxes(expr, f, evaluation, **kwargs):
209212
"""MakeBoxes[expr_,
210213
f:TraditionalForm|StandardForm]"""
211214
from mathics.builtin.box.layout import RowBox
@@ -224,7 +227,7 @@ def eval_generic_makeboxes(expr, f, evaluation):
224227

225228
printform_callback = PRINT_FORMS_CALLBACK.get(head.get_name(), None)
226229
if printform_callback is not None:
227-
return printform_callback(elements[0], evaluation)
230+
return printform_callback(elements[0], evaluation, **kwargs)
228231

229232
f_name = f.get_name()
230233
if f_name == "System`TraditionalForm":
@@ -296,7 +299,7 @@ def format_element(
296299
if form not in evaluation.definitions.boxforms:
297300
formatted_expr = Expression(form, formatted_expr)
298301
form = SymbolStandardForm
299-
result_box = apply_makeboxes_rules(formatted_expr, evaluation, form)
302+
result_box = apply_makeboxes_rules(formatted_expr, evaluation, form, **kwargs)
300303
if isinstance(result_box, BoxElementMixin):
301304
return result_box
302305
return eval_makeboxes_fullform_recursive(element, evaluation)

test/builtin/assignments/test_assignment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99
# TODO: consider to split this module in sub-modules.
1010

11-
from test.helper import check_evaluation, session
11+
from test.helper import check_evaluation
1212

1313
import pytest
1414
from mathics_scanner.errors import IncompleteSyntaxError

0 commit comments

Comments
 (0)