Skip to content

Commit 20b6a8b

Browse files
committed
Finish option checking for AlphabeticOrder
1 parent bf36722 commit 20b6a8b

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

pymathics/icu/__main__.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from mathics.core.builtin import Builtin
1414
from mathics.core.convert.expression import to_mathics_list
1515
from mathics.core.evaluation import Evaluation
16-
from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue
16+
from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue, strip_context
1717
from mathics.core.systemsymbols import SymbolAutomatic
1818

1919
available_locales = Locale.getAvailableLocales()
@@ -84,7 +84,7 @@ def from_dict(
8484
evaluation.message(
8585
"AlphabeticOrder",
8686
"nodef",
87-
Symbol(raw_key),
87+
String(strip_context(raw_key)),
8888
String("AlphabeticOrder"),
8989
)
9090
return
@@ -98,9 +98,9 @@ def from_dict(
9898
if option_value not in (SymbolTrue, SymbolFalse):
9999
evaluation.message(
100100
"AlphabeticOrder",
101-
"nodef",
102-
Symbol(raw_key),
103-
String("AlphabeticOrder"),
101+
"opttf",
102+
String(strip_context(raw_key)),
103+
option_value,
104104
)
105105
return
106106
processed_args[normalized_key] = option_value.value
@@ -109,15 +109,10 @@ def from_dict(
109109
if option_value is SymbolLanguage:
110110
option_value = String(LANGUAGE)
111111

112-
if not isinstance(option_value, String):
113-
evaluation.message(
114-
"AlphabeticOrder",
115-
"nodef",
116-
Symbol(raw_key),
117-
String("AlphabeticOrder"),
118-
)
119-
return
120-
processed_args[normalized_key] = option_value
112+
# In contrast to True/False values for other options,
113+
# if the Language option is not a string, WMA just ignores the option.
114+
if isinstance(option_value, String):
115+
processed_args[normalized_key] = option_value
121116

122117
elif normalized_key == "lowercase_ordering":
123118
if (option_value is SymbolAutomatic) or option_value == "Automatic":

0 commit comments

Comments
 (0)