MCPcopy Create free account
hub / github.com/ipython/ipython / doctest_precision

Function doctest_precision

IPython/core/tests/test_magic.py:608–624  ·  view source on GitHub ↗

doctest for %precision In [1]: f = get_ipython().display_formatter.formatters['text/plain'] In [2]: %precision 5 Out[2]: '%.5f' In [3]: f.float_format Out[3]: '%.5f' In [4]: %precision %e Out[4]: '%e' In [5]: f(3.1415927) Out[5]: '3.141593

()

Source from the content-addressed store, hash-verified

606 _ip.magic("whos")
607
608def doctest_precision():
609 """doctest for %precision
610
611 In [1]: f = get_ipython().display_formatter.formatters['text/plain']
612
613 In [2]: %precision 5
614 Out[2]: '%.5f'
615
616 In [3]: f.float_format
617 Out[3]: '%.5f'
618
619 In [4]: %precision %e
620 Out[4]: '%e'
621
622 In [5]: f(3.1415927)
623 Out[5]: '3.141593e+00'
624 """
625
626def test_debug_magic():
627 """Test debugging a small code with %debug

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected