zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
U
­ý°d1!ã@szddlZddlZddlZddlmZmZdd„Zdd„Zdd„Z    d    d
„Z
d d „Z d d„Z dd„Z dd„ZGdd„dƒZdS)éN)ÚIndexÚ
MultiIndexcCs| ¡|dd… ¡dS)Nr)Úformat©Úidx©rú^d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/indexes/multi/test_formats.pyÚ test_format sr    cCsBtddgddggddddgddddggddgd}|jdddS)Nré)ÚlevelsÚcodesÚnamesT©r )rr)ÚindexrrrÚtest_format_integer_namess ÿrc    Cs4t dd¡| ¡}W5QRX|ddks0t‚dS)Nzdisplay.multi_sparseFr
zfoo  two)ÚpdÚoption_contextrÚAssertionError)rÚresultrrrÚtest_format_sparse_configsrc Csvtddgddgddgdggddddddgddddddgddddddgddddddggd}| ¡}|ddksrt‚dS)Nrr
©r r éz
1  0  0  0)rrr)rrrrrÚtest_format_sparse_displaysüþ
rc    Cs`t dd¡Jdddgdddgd    d
d gd œ}t |¡ d dg¡j}dt|ƒksRt‚W5QRXdS)Nzdisplay.encodingzUTF-8õאéréééééé    ©ÚaÚbÚcr"r#ú\)rrÚ    DataFrameÚ    set_indexrÚreprr)ÚdrrrrÚtest_repr_with_unicode_data-sr*c    CsLtjtdƒtdƒgddgd}d}tjt|dtt|ƒƒW5QRXdS)NÚabrÚfirstÚsecondrzMust pass both levels and codes)Úmatch)    rZ from_productÚlistÚrangeÚpytestZraisesÚ    TypeErrorÚevalr()ÚmiÚmsgrrrÚtest_repr_roundtrip_raises4sr6cCs@dddgdddgddd    gd
œ}t |¡ d d g¡j}t|ƒdS) Nrrrrrrrrr r!r"r#)rr&r'rÚstr)r)rrrrÚ test_unicode_string_with_unicode;sr8c    Cs>| d¡}t dd¡t|ƒdt|ƒks0t‚W5QRXdS)Né2údisplay.max_seq_itemsz...)Úrepeatrrr(r7rrrrrÚtest_repr_max_seq_item_settingAs
r<c@s4eZdZdd„Zdd„Zdd„Zdd„Zd    d
„Zd S) ÚTestReprcCsdtdddgƒtddgƒg}t d¡ d¡t t d¡d¡g}t||d}t|jƒt| d¡ƒdS)    Nua/σub/σuc/σrr
rrr)    rÚnpZaranger;Ztilerr(r Zget_level_values)Úselfr r rrrrÚtest_unicode_repr_issuesJs
" 
z!TestRepr.test_unicode_repr_issuesc    Cs4t dd¡| ¡}d}||ks&t‚W5QRXdS)Nr:rúÎMultiIndex([('foo', 'one'),
            ('foo', 'two'),
            ('bar', 'one'),
            ('baz', 'two'),
            ('qux', 'one'),
            ('qux', 'two')],
           names=['first', 'second']))rrÚ__repr__r©r?rrÚexpectedrrrÚ"test_repr_max_seq_items_equal_to_nRsz+TestRepr.test_repr_max_seq_items_equal_to_nc    Csœ|dd… ¡}d}||ks t‚| ¡}d}||ks8t‚t dd¡| ¡}d}||ks^t‚W5QRXt dd¡| ¡}d}||ksŽt‚W5QRXdS)Nr
zBMultiIndex([('foo', 'one')],
           names=['first', 'second'])rAr:rz°MultiIndex([('foo', 'one'),
            ('foo', 'two'),
            ...
            ('qux', 'one'),
            ('qux', 'two')],
           names=['first', 'second'], length=6)zWMultiIndex([...
            ('qux', 'two')],
           names=['first', ...], length=6))rBrrrrCrrrÚ    test_repr`s  zTestRepr.test_reprcCsb|}|dd… ¡}d}||ks$t‚|ddd… ¡}d}||ksFt‚| ¡}d}||ks^t‚dS)Nr
zQMultiIndex([('a', 9, '2000-01-01 00:00:00')],
           names=['a', 'b', 'dti'])iôzäMultiIndex([(  'a',  9, '2000-01-01 00:00:00'),
            (  'a',  9, '2000-01-01 00:08:20'),
            ('abc', 10, '2000-01-01 00:16:40'),
            ('abc', 10, '2000-01-01 00:25:00')],
           names=['a', 'b', 'dti'])aMultiIndex([(  'a',  9, '2000-01-01 00:00:00'),
            (  'a',  9, '2000-01-01 00:00:01'),
            (  'a',  9, '2000-01-01 00:00:02'),
            (  'a',  9, '2000-01-01 00:00:03'),
            (  'a',  9, '2000-01-01 00:00:04'),
            (  'a',  9, '2000-01-01 00:00:05'),
            (  'a',  9, '2000-01-01 00:00:06'),
            (  'a',  9, '2000-01-01 00:00:07'),
            (  'a',  9, '2000-01-01 00:00:08'),
            (  'a',  9, '2000-01-01 00:00:09'),
            ...
            ('abc', 10, '2000-01-01 00:33:10'),
            ('abc', 10, '2000-01-01 00:33:11'),
            ('abc', 10, '2000-01-01 00:33:12'),
            ('abc', 10, '2000-01-01 00:33:13'),
            ('abc', 10, '2000-01-01 00:33:14'),
            ('abc', 10, '2000-01-01 00:33:15'),
            ('abc', 10, '2000-01-01 00:33:16'),
            ('abc', 10, '2000-01-01 00:33:17'),
            ('abc', 10, '2000-01-01 00:33:18'),
            ('abc', 10, '2000-01-01 00:33:19')],
           names=['a', 'b', 'dti'], length=2000)©rBr)r?Znarrow_multi_indexr4rrDrrrÚ
test_rjust†s  zTestRepr.test_rjustcCs`|}|dd… ¡}d}||ks$t‚|dd… ¡}d}||ksDt‚| ¡}d}||ks\t‚dS)Nr
zMultiIndex([('a', 9, '2000-01-01 00:00:00', '2000-01-01 00:00:00', ...)],
           names=['a', 'b', 'dti_1', 'dti_2', 'dti_3'])é
aMultiIndex([('a', 9, '2000-01-01 00:00:00', '2000-01-01 00:00:00', ...),
            ('a', 9, '2000-01-01 00:00:01', '2000-01-01 00:00:01', ...),
            ('a', 9, '2000-01-01 00:00:02', '2000-01-01 00:00:02', ...),
            ('a', 9, '2000-01-01 00:00:03', '2000-01-01 00:00:03', ...),
            ('a', 9, '2000-01-01 00:00:04', '2000-01-01 00:00:04', ...),
            ('a', 9, '2000-01-01 00:00:05', '2000-01-01 00:00:05', ...),
            ('a', 9, '2000-01-01 00:00:06', '2000-01-01 00:00:06', ...),
            ('a', 9, '2000-01-01 00:00:07', '2000-01-01 00:00:07', ...),
            ('a', 9, '2000-01-01 00:00:08', '2000-01-01 00:00:08', ...),
            ('a', 9, '2000-01-01 00:00:09', '2000-01-01 00:00:09', ...)],
           names=['a', 'b', 'dti_1', 'dti_2', 'dti_3'])aEMultiIndex([(  'a',  9, '2000-01-01 00:00:00', '2000-01-01 00:00:00', ...),
            (  'a',  9, '2000-01-01 00:00:01', '2000-01-01 00:00:01', ...),
            (  'a',  9, '2000-01-01 00:00:02', '2000-01-01 00:00:02', ...),
            (  'a',  9, '2000-01-01 00:00:03', '2000-01-01 00:00:03', ...),
            (  'a',  9, '2000-01-01 00:00:04', '2000-01-01 00:00:04', ...),
            (  'a',  9, '2000-01-01 00:00:05', '2000-01-01 00:00:05', ...),
            (  'a',  9, '2000-01-01 00:00:06', '2000-01-01 00:00:06', ...),
            (  'a',  9, '2000-01-01 00:00:07', '2000-01-01 00:00:07', ...),
            (  'a',  9, '2000-01-01 00:00:08', '2000-01-01 00:00:08', ...),
            (  'a',  9, '2000-01-01 00:00:09', '2000-01-01 00:00:09', ...),
            ...
            ('abc', 10, '2000-01-01 00:33:10', '2000-01-01 00:33:10', ...),
            ('abc', 10, '2000-01-01 00:33:11', '2000-01-01 00:33:11', ...),
            ('abc', 10, '2000-01-01 00:33:12', '2000-01-01 00:33:12', ...),
            ('abc', 10, '2000-01-01 00:33:13', '2000-01-01 00:33:13', ...),
            ('abc', 10, '2000-01-01 00:33:14', '2000-01-01 00:33:14', ...),
            ('abc', 10, '2000-01-01 00:33:15', '2000-01-01 00:33:15', ...),
            ('abc', 10, '2000-01-01 00:33:16', '2000-01-01 00:33:16', ...),
            ('abc', 10, '2000-01-01 00:33:17', '2000-01-01 00:33:17', ...),
            ('abc', 10, '2000-01-01 00:33:18', '2000-01-01 00:33:18', ...),
            ('abc', 10, '2000-01-01 00:33:19', '2000-01-01 00:33:19', ...)],
           names=['a', 'b', 'dti_1', 'dti_2', 'dti_3'], length=2000)rG)r?Zwide_multi_indexr4rrDrrrÚtest_tuple_width±s  zTestRepr.test_tuple_widthN)Ú__name__Ú
__module__Ú __qualname__r@rErFrHrJrrrrr=Is
&+r=)Únumpyr>r1Zpandasrrrr    rrrr*r6r8r<r=rrrrÚ<module>s