Skip to content

Commit 38ffbc4

Browse files
committed
updated set_options() doctests to be compatible with Python 2.7
1 parent f10b106 commit 38ffbc4

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

larray/core/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2300,7 +2300,7 @@ def as_table(self, maxlines=None, edgeitems=None, light=False, wide=True, value_
23002300
edgeitems : int, optional
23012301
If number of lines to display is greater than `maxlines`,
23022302
only the first and last `edgeitems` lines are displayed.
2303-
Only active if `maxlines` is not None.
2303+
Only active if `maxlines` is not 0.
23042304
See :py:obj:`set_options` for default value.
23052305
light: bool, optional
23062306
Whether or not printing the array in the same way as a pandas DataFrame with a MultiIndex

larray/util/options.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,40 +57,40 @@ class set_options(object):
5757
Defaults to 200.
5858
- ``display_edgeitems`` : if number of lines to display is greater than ``display_maxlines``,
5959
only the first and last ``display_edgeitems`` lines are displayed.
60-
Only active if ``display_maxlines`` is not None. Defaults to 5.
60+
Only active if ``display_maxlines`` is not 0. Defaults to 5.
6161
6262
Examples
6363
--------
6464
>>> from larray import *
65-
>>> arr = ndtest((500, 100), dtype=float) / 3
65+
>>> arr = ndtest((500, 100), dtype=float) + 0.123456
6666
6767
You can use ``set_options`` either as a context manager:
6868
6969
>>> with set_options(display_width=100, display_edgeitems=2):
7070
... print(arr)
71-
a\b b0 b1 ... b98 b99
72-
a0 0.0 0.3333333333333333 ... 32.666666666666664 33.0
73-
a1 33.333333333333336 33.666666666666664 ... 66.0 66.33333333333333
74-
... ... ... ... ... ...
75-
a498 16600.0 16600.333333333332 ... 16632.666666666668 16633.0
76-
a499 16633.333333333332 16633.666666666668 ... 16666.0 16666.333333333332
71+
a\b b0 b1 b2 ... b97 b98 b99
72+
a0 0.123456 1.123456 2.123456 ... 97.123456 98.123456 99.123456
73+
a1 100.123456 101.123456 102.123456 ... 197.123456 198.123456 199.123456
74+
... ... ... ... ... ... ... ...
75+
a498 49800.123456 49801.123456 49802.123456 ... 49897.123456 49898.123456 49899.123456
76+
a499 49900.123456 49901.123456 49902.123456 ... 49997.123456 49998.123456 49999.123456
7777
7878
Or to set global options:
7979
8080
>>> set_options(display_maxlines=10, display_precision=2) # doctest: +SKIP
8181
>>> print(arr) # doctest: +SKIP
8282
a\b b0 b1 b2 ... b97 b98 b99
83-
a0 0.00 0.33 0.67 ... 32.33 32.67 33.00
84-
a1 33.33 33.67 34.00 ... 65.67 66.00 66.33
85-
a2 66.67 67.00 67.33 ... 99.00 99.33 99.67
86-
a3 100.00 100.33 100.67 ... 132.33 132.67 133.00
87-
a4 133.33 133.67 134.00 ... 165.67 166.00 166.33
83+
a0 0.12 1.12 2.12 ... 97.12 98.12 99.12
84+
a1 100.12 101.12 102.12 ... 197.12 198.12 199.12
85+
a2 200.12 201.12 202.12 ... 297.12 298.12 299.12
86+
a3 300.12 301.12 302.12 ... 397.12 398.12 399.12
87+
a4 400.12 401.12 402.12 ... 497.12 498.12 499.12
8888
... ... ... ... ... ... ... ...
89-
a495 16500.00 16500.33 16500.67 ... 16532.33 16532.67 16533.00
90-
a496 16533.33 16533.67 16534.00 ... 16565.67 16566.00 16566.33
91-
a497 16566.67 16567.00 16567.33 ... 16599.00 16599.33 16599.67
92-
a498 16600.00 16600.33 16600.67 ... 16632.33 16632.67 16633.00
93-
a499 16633.33 16633.67 16634.00 ... 16665.67 16666.00 16666.33
89+
a495 49500.12 49501.12 49502.12 ... 49597.12 49598.12 49599.12
90+
a496 49600.12 49601.12 49602.12 ... 49697.12 49698.12 49699.12
91+
a497 49700.12 49701.12 49702.12 ... 49797.12 49798.12 49799.12
92+
a498 49800.12 49801.12 49802.12 ... 49897.12 49898.12 49899.12
93+
a499 49900.12 49901.12 49902.12 ... 49997.12 49998.12 49999.12
9494
"""
9595

9696
def __init__(self, **kwargs):

0 commit comments

Comments
 (0)