Skip to content

Commit 9b1ad76

Browse files
authored
moving private doctests from mathics.builtin.list (#904)
Another round of moving private doctests to pytests.
1 parent 524cd40 commit 9b1ad76

File tree

10 files changed

+687
-424
lines changed

10 files changed

+687
-424
lines changed

mathics/builtin/list/associations.py

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,6 @@ class Association(Builtin):
4646
Associations can be nested:
4747
>> <|a -> x, b -> y, <|a -> z, d -> t|>|>
4848
= <|a -> z, b -> y, d -> t|>
49-
50-
#> <|a -> x, b -> y, c -> <|d -> t|>|>
51-
= <|a -> x, b -> y, c -> <|d -> t|>|>
52-
#> %["s"]
53-
= Missing[KeyAbsent, s]
54-
55-
#> <|a -> x, b + c -> y, {<|{}|>, a -> {z}}|>
56-
= <|a -> {z}, b + c -> y|>
57-
#> %[a]
58-
= {z}
59-
60-
#> <|"x" -> 1, {y} -> 1|>
61-
= <|x -> 1, {y} -> 1|>
62-
#> %["x"]
63-
= 1
64-
65-
#> <|<|a -> v|> -> x, <|b -> y, a -> <|c -> z|>, {}, <||>|>, {d}|>[c]
66-
= Association[Association[a -> v] -> x, Association[b -> y, a -> Association[c -> z], {}, Association[]], {d}][c]
67-
68-
#> <|<|a -> v|> -> x, <|b -> y, a -> <|c -> z|>, {d}|>, {}, <||>|>[a]
69-
= Association[Association[a -> v] -> x, Association[b -> y, a -> Association[c -> z], {d}], {}, Association[]][a]
70-
71-
#> <|<|a -> v|> -> x, <|b -> y, a -> <|c -> z, {d}|>, {}, <||>|>, {}, <||>|>
72-
= <|<|a -> v|> -> x, b -> y, a -> Association[c -> z, {d}]|>
73-
#> %[a]
74-
= Association[c -> z, {d}]
75-
76-
#> <|a -> x, b -> y, c -> <|d -> t|>|> // ToBoxes
77-
= RowBox[{<|, RowBox[{RowBox[{a, ->, x}], ,, RowBox[{b, ->, y}], ,, RowBox[{c, ->, RowBox[{<|, RowBox[{d, ->, t}], |>}]}]}], |>}]
78-
79-
#> Association[a -> x, b -> y, c -> Association[d -> t, Association[e -> u]]] // ToBoxes
80-
= RowBox[{<|, RowBox[{RowBox[{a, ->, x}], ,, RowBox[{b, ->, y}], ,, RowBox[{c, ->, RowBox[{<|, RowBox[{RowBox[{d, ->, t}], ,, RowBox[{e, ->, u}]}], |>}]}]}], |>}]
8149
"""
8250

8351
error_idx = 0
@@ -237,41 +205,6 @@ class Keys(Builtin):
237205
Keys are listed in the order of their appearance:
238206
>> Keys[{c -> z, b -> y, a -> x}]
239207
= {c, b, a}
240-
241-
#> Keys[a -> x]
242-
= a
243-
244-
#> Keys[{a -> x, a -> y, {a -> z, <|b -> t|>, <||>, {}}}]
245-
= {a, a, {a, {b}, {}, {}}}
246-
247-
#> Keys[{a -> x, a -> y, <|a -> z, {b -> t}, <||>, {}|>}]
248-
= {a, a, {a, b}}
249-
250-
#> Keys[<|a -> x, a -> y, <|a -> z, <|b -> t|>, <||>, {}|>|>]
251-
= {a, b}
252-
253-
#> Keys[<|a -> x, a -> y, {a -> z, {b -> t}, <||>, {}}|>]
254-
= {a, b}
255-
256-
#> Keys[<|a -> x, <|a -> y, b|>|>]
257-
: The argument Association[a -> x, Association[a -> y, b]] is not a valid Association or a list of rules.
258-
= Keys[Association[a -> x, Association[a -> y, b]]]
259-
260-
#> Keys[<|a -> x, {a -> y, b}|>]
261-
: The argument Association[a -> x, {a -> y, b}] is not a valid Association or a list of rules.
262-
= Keys[Association[a -> x, {a -> y, b}]]
263-
264-
#> Keys[{a -> x, <|a -> y, b|>}]
265-
: The argument Association[a -> y, b] is not a valid Association or a list of rules.
266-
= Keys[{a -> x, Association[a -> y, b]}]
267-
268-
#> Keys[{a -> x, {a -> y, b}}]
269-
: The argument b is not a valid Association or a list of rules.
270-
= Keys[{a -> x, {a -> y, b}}]
271-
272-
#> Keys[a -> x, b -> y]
273-
: Keys called with 2 arguments; 1 argument is expected.
274-
= Keys[a -> x, b -> y]
275208
"""
276209

277210
attributes = A_PROTECTED
@@ -372,40 +305,6 @@ class Values(Builtin):
372305
>> Values[{c -> z, b -> y, a -> x}]
373306
= {z, y, x}
374307
375-
#> Values[a -> x]
376-
= x
377-
378-
#> Values[{a -> x, a -> y, {a -> z, <|b -> t|>, <||>, {}}}]
379-
= {x, y, {z, {t}, {}, {}}}
380-
381-
#> Values[{a -> x, a -> y, <|a -> z, {b -> t}, <||>, {}|>}]
382-
= {x, y, {z, t}}
383-
384-
#> Values[<|a -> x, a -> y, <|a -> z, <|b -> t|>, <||>, {}|>|>]
385-
= {z, t}
386-
387-
#> Values[<|a -> x, a -> y, {a -> z, {b -> t}, <||>, {}}|>]
388-
= {z, t}
389-
390-
#> Values[<|a -> x, <|a -> y, b|>|>]
391-
: The argument Association[a -> x, Association[a -> y, b]] is not a valid Association or a list of rules.
392-
= Values[Association[a -> x, Association[a -> y, b]]]
393-
394-
#> Values[<|a -> x, {a -> y, b}|>]
395-
: The argument Association[a -> x, {a -> y, b}] is not a valid Association or a list of rules.
396-
= Values[Association[a -> x, {a -> y, b}]]
397-
398-
#> Values[{a -> x, <|a -> y, b|>}]
399-
: The argument {a -> x, Association[a -> y, b]} is not a valid Association or a list of rules.
400-
= Values[{a -> x, Association[a -> y, b]}]
401-
402-
#> Values[{a -> x, {a -> y, b}}]
403-
: The argument {a -> x, {a -> y, b}} is not a valid Association or a list of rules.
404-
= Values[{a -> x, {a -> y, b}}]
405-
406-
#> Values[a -> x, b -> y]
407-
: Values called with 2 arguments; 1 argument is expected.
408-
= Values[a -> x, b -> y]
409308
"""
410309

411310
attributes = A_PROTECTED

0 commit comments

Comments
 (0)