Skip to content

Commit ca9b652

Browse files
committed
Go over doc examples to remove fragility
1 parent a92b0b0 commit ca9b652

1 file changed

Lines changed: 4 additions & 25 deletions

File tree

mathics/builtin/scoping.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,6 @@ class Context(Builtin):
364364
= Global`
365365
>> Context[b`c]
366366
= b`
367-
>> Context[Sin] // InputForm
368-
= "System`"
369367
370368
>> InputForm[Context[]]
371369
= "Global`"
@@ -413,8 +411,7 @@ class Contexts(Builtin):
413411
414412
## this assignment makes sure that a definition in Global` exists
415413
>> x = 5;
416-
>> Contexts[] // InputForm
417-
= {"CombinatoricaOld`", "Global`", "ImportExport`", "Internal`", "System`", "System`Convert`B64Dump`", "System`Convert`Image`", "System`Convert`JSONDump`", "System`Convert`TableDump`", "System`Convert`TextDump`", "System`Private`", "XML`", "XML`Parser`"}
414+
X> Contexts[] // InputForm
418415
"""
419416

420417
def apply(self, evaluation):
@@ -465,17 +462,12 @@ class ContextPath(Predefined):
465462
<dd>is the search path for contexts.
466463
</dl>
467464
468-
>> $ContextPath // InputForm
469-
= {"Global`", "System`"}
470-
471-
#> $ContextPath = Sin[2]
472-
: Sin[2] is not a list of valid context names ending in `.
473-
= Sin[2]
465+
X> $ContextPath // InputForm
474466
475467
#> x`x = 1; x
476468
= x
477-
#> $ContextPath = {"x`"};
478-
#> x
469+
>> $ContextPath = {"x`"};
470+
>> x
479471
= 1
480472
#> System`$ContextPath
481473
= {x`}
@@ -502,8 +494,6 @@ class Begin(Builtin):
502494
503495
>> Begin["test`"]
504496
= test`
505-
>> {$Context, $ContextPath}
506-
= {test`, {Global`, System`}}
507497
>> Context[newsymbol]
508498
= test`
509499
>> End[]
@@ -569,19 +559,8 @@ class BeginPackage(Builtin):
569559
'BeginPackage' changes the values of '$Context' and
570560
'$ContextPath', setting the current context to $context$.
571561
572-
>> {$Context, $ContextPath}
573-
= {Global`, {Global`, System`}}
574562
>> BeginPackage["test`"]
575563
= test`
576-
>> {$Context, $ContextPath}
577-
= {test`, {test`, System`}}
578-
>> Context[newsymbol]
579-
= test`
580-
>> EndPackage[]
581-
>> {$Context, $ContextPath}
582-
= {Global`, {test`, Global`, System`}}
583-
>> EndPackage[]
584-
: No previous context defined.
585564
"""
586565

587566
messages = {

0 commit comments

Comments
 (0)