Test assert failures should have distinct failure messages.
Consider:
(
"A=1; B=2; Clear[A, $Context, B];{A,$Context,B}",
"{A, Global`, B}",
"This clears A and B, but not $Context",
("Special symbol $Context cannot be cleared.",),
),
(
"A=1; B=2; ClearAll[A, $Context, B];{A,$Context,B}",
"{A, Global`, B}",
"This clears A and B, but not $Context",
("Special symbol $Context cannot be cleared.",),
),
When we run the test and if it fails, it is not immediately clear which of the two similar tests is failing from the failure message.
Better:
```python
(
"A=1; B=2; Clear[A, $Context, B];{A,$Context,B}",
"{A, Global`, B}",
"This clears A and B via Clear, but not $Context",
("Special symbol $Context cannot be cleared.",),
),
(
"A=1; B=2; ClearAll[A, $Context, B];{A,$Context,B}",
"{A, Global`, B}",
"This clears A and B via ClearAll, but not $Context",
("Special symbol $Context cannot be cleared.",),
),
The failure message also makes it easier to tell what is different between the two similar tests.
There are numerous other examples in test_assignment and possibly elsewhere.
Test assert failures should have distinct failure messages.
Consider:
( "A=1; B=2; Clear[A, $Context, B];{A,$Context,B}", "{A, Global`, B}", "This clears A and B, but not $Context", ("Special symbol $Context cannot be cleared.",), ), ( "A=1; B=2; ClearAll[A, $Context, B];{A,$Context,B}", "{A, Global`, B}", "This clears A and B, but not $Context", ("Special symbol $Context cannot be cleared.",), ),When we run the test and if it fails, it is not immediately clear which of the two similar tests is failing from the failure message.
Better:
The failure message also makes it easier to tell what is different between the two similar tests.
There are numerous other examples in
test_assignmentand possibly elsewhere.