Skip to content

Commit b38ec6b

Browse files
committed
fix(core): don't sympify strings in doctest
The Dict doctest relied on auto-sympification of strings in calling D.has('one'). This commit uses Symbol explicitly because has no longer accepts string input after 9c57fd0 BREAKING CHANGE: Using D.has('x') where D is a SymPy Dict will raise an exception. Use D.has(Symbol('x')) instead.
1 parent febdf8a commit b38ec6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sympy/core/containers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ class Dict(Basic):
202202
cannot be changed afterwards. Otherwise it behaves identically
203203
to the Python dict.
204204
205+
>>> from sympy import Symbol
205206
>>> from sympy.core.containers import Dict
206207
207208
>>> D = Dict({1: 'one', 2: 'two'})
@@ -215,7 +216,7 @@ class Dict(Basic):
215216
216217
>>> 1 in D
217218
True
218-
>>> D.has('one') # searches keys and values
219+
>>> D.has(Symbol('one')) # searches keys and values
219220
True
220221
>>> 'one' in D # not in the keys
221222
False

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy