ZTWHHH commited on
Commit
596ab37
·
verified ·
1 Parent(s): 778d3f3

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/__init__.cpython-310.pyc +0 -0
  2. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/generate_legacy_storage_files.cpython-310.pyc +0 -0
  3. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_clipboard.cpython-310.pyc +0 -0
  4. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_common.cpython-310.pyc +0 -0
  5. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_compression.cpython-310.pyc +0 -0
  6. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_feather.cpython-310.pyc +0 -0
  7. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_fsspec.cpython-310.pyc +0 -0
  8. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_sql.cpython-310.pyc +0 -0
  9. videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_stata.cpython-310.pyc +0 -0
  10. videochat2/lib/python3.10/site-packages/pandas/tests/io/data/fixed_width/fixed_width_format.txt +3 -0
  11. videochat2/lib/python3.10/site-packages/pandas/tests/io/data/gbq_fake_job.txt +1 -0
  12. videochat2/lib/python3.10/site-packages/pandas/tests/io/data/xml/books.xml +21 -0
  13. videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_bar.cpython-310.pyc +0 -0
  14. videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_highlight.cpython-310.pyc +0 -0
  15. videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_non_unique.cpython-310.pyc +0 -0
  16. videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_style.cpython-310.pyc +0 -0
  17. videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_tooltip.cpython-310.pyc +0 -0
  18. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/__pycache__/__init__.cpython-310.pyc +0 -0
  19. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/__pycache__/test_python_parser_only.cpython-310.pyc +0 -0
  20. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/__pycache__/test_quoting.cpython-310.pyc +0 -0
  21. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/__pycache__/test_unsupported.cpython-310.pyc +0 -0
  22. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/__init__.py +0 -0
  23. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/__pycache__/test_strings.cpython-310.pyc +0 -0
  24. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/__pycache__/test_usecols_basic.cpython-310.pyc +0 -0
  25. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/test_parse_dates.py +159 -0
  26. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/test_strings.py +97 -0
  27. videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/test_usecols_basic.py +432 -0
  28. videochat2/lib/python3.10/site-packages/pandas/tests/util/__init__.py +0 -0
  29. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_attr_equal.cpython-310.pyc +0 -0
  30. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_extension_array_equal.cpython-310.pyc +0 -0
  31. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_frame_equal.cpython-310.pyc +0 -0
  32. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_index_equal.cpython-310.pyc +0 -0
  33. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_interval_array_equal.cpython-310.pyc +0 -0
  34. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_numpy_array_equal.cpython-310.pyc +0 -0
  35. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_produces_warning.cpython-310.pyc +0 -0
  36. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_series_equal.cpython-310.pyc +0 -0
  37. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_deprecate.cpython-310.pyc +0 -0
  38. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_deprecate_kwarg.cpython-310.pyc +0 -0
  39. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_doc.cpython-310.pyc +0 -0
  40. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_hashing.cpython-310.pyc +0 -0
  41. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_make_objects.cpython-310.pyc +0 -0
  42. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_numba.cpython-310.pyc +0 -0
  43. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_rewrite_warning.cpython-310.pyc +0 -0
  44. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_show_versions.cpython-310.pyc +0 -0
  45. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_str_methods.cpython-310.pyc +0 -0
  46. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_validate_args_and_kwargs.cpython-310.pyc +0 -0
  47. videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_validate_inclusive.cpython-310.pyc +0 -0
  48. videochat2/lib/python3.10/site-packages/pandas/tests/util/conftest.py +26 -0
  49. videochat2/lib/python3.10/site-packages/pandas/tests/util/test_assert_almost_equal.py +533 -0
  50. videochat2/lib/python3.10/site-packages/pandas/tests/util/test_assert_attr_equal.py +33 -0
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (171 Bytes). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/generate_legacy_storage_files.cpython-310.pyc ADDED
Binary file (8.31 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_clipboard.cpython-310.pyc ADDED
Binary file (13.5 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_common.cpython-310.pyc ADDED
Binary file (20.5 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_compression.cpython-310.pyc ADDED
Binary file (9.79 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_feather.cpython-310.pyc ADDED
Binary file (8.55 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_fsspec.cpython-310.pyc ADDED
Binary file (8.12 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_sql.cpython-310.pyc ADDED
Binary file (96.1 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/__pycache__/test_stata.cpython-310.pyc ADDED
Binary file (81.9 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/data/fixed_width/fixed_width_format.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ A B C
2
+ 1 2 3
3
+ 4 5 6
videochat2/lib/python3.10/site-packages/pandas/tests/io/data/gbq_fake_job.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ {'status': {'state': 'DONE'}, 'kind': 'bigquery#job', 'statistics': {'query': {'cacheHit': True, 'totalBytesProcessed': '0'}, 'endTime': '1377668744674', 'totalBytesProcessed': '0', 'startTime': '1377668744466'}, 'jobReference': {'projectId': '57288129629', 'jobId': 'bqjob_r5f956972f0190bdf_00000140c374bf42_2'}, 'etag': '"4PTsVxg68bQkQs1RJ1Ndewqkgg4/oO4VmgFrAku4N6FWci9s7iFIftc"', 'configuration': {'query': {'createDisposition': 'CREATE_IF_NEEDED', 'query': 'SELECT * FROM [publicdata:samples.shakespeare]', 'writeDisposition': 'WRITE_TRUNCATE', 'destinationTable': {'projectId': '57288129629', 'tableId': 'anonb5ec450da88eeeb78a27784ea482ee75a146d442', 'datasetId': '_d0b4f5f0d50dc68a3eb0fa6cba66a9a8687d9253'}}}, 'id': '57288129629:bqjob_r5f956972f0190bdf_00000140c374bf42_2', 'selfLink': 'https://www.googleapis.com/bigquery/v2/projects/57288129629/jobs/bqjob_r5f956972f0190bdf_00000140c374bf42_2'}
videochat2/lib/python3.10/site-packages/pandas/tests/io/data/xml/books.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <bookstore>
3
+ <book category="cooking">
4
+ <title lang="en">Everyday Italian</title>
5
+ <author>Giada De Laurentiis</author>
6
+ <year>2005</year>
7
+ <price>30.00</price>
8
+ </book>
9
+ <book category="children">
10
+ <title lang="en">Harry Potter</title>
11
+ <author>J K. Rowling</author>
12
+ <year>2005</year>
13
+ <price>29.99</price>
14
+ </book>
15
+ <book category="web">
16
+ <title lang="en">Learning XML</title>
17
+ <author>Erik T. Ray</author>
18
+ <year>2003</year>
19
+ <price>39.95</price>
20
+ </book>
21
+ </bookstore>
videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_bar.cpython-310.pyc ADDED
Binary file (7.45 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_highlight.cpython-310.pyc ADDED
Binary file (5.49 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_non_unique.cpython-310.pyc ADDED
Binary file (4.15 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_style.cpython-310.pyc ADDED
Binary file (49.7 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/formats/style/__pycache__/test_tooltip.cpython-310.pyc ADDED
Binary file (2.66 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (178 Bytes). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/__pycache__/test_python_parser_only.cpython-310.pyc ADDED
Binary file (14 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/__pycache__/test_quoting.cpython-310.pyc ADDED
Binary file (4.45 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/__pycache__/test_unsupported.cpython-310.pyc ADDED
Binary file (8.27 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/__init__.py ADDED
File without changes
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/__pycache__/test_strings.cpython-310.pyc ADDED
Binary file (2.27 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/__pycache__/test_usecols_basic.cpython-310.pyc ADDED
Binary file (10.8 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/test_parse_dates.py ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests the usecols functionality during parsing
3
+ for all of the parsers defined in parsers.py
4
+ """
5
+ from io import StringIO
6
+
7
+ import pytest
8
+
9
+ from pandas import (
10
+ DataFrame,
11
+ Index,
12
+ Timestamp,
13
+ )
14
+ import pandas._testing as tm
15
+
16
+ _msg_validate_usecols_arg = (
17
+ "'usecols' must either be list-like "
18
+ "of all strings, all unicode, all "
19
+ "integers or a callable."
20
+ )
21
+ _msg_validate_usecols_names = (
22
+ "Usecols do not match columns, columns expected but not found: {0}"
23
+ )
24
+
25
+ # TODO(1.4): Change these to xfails whenever parse_dates support(which was
26
+ # intentionally disable to keep small PR sizes) is added back
27
+ pytestmark = pytest.mark.usefixtures("pyarrow_skip")
28
+
29
+
30
+ @pytest.mark.parametrize("usecols", [[0, 2, 3], [3, 0, 2]])
31
+ def test_usecols_with_parse_dates(all_parsers, usecols):
32
+ # see gh-9755
33
+ data = """a,b,c,d,e
34
+ 0,1,2014-01-01,09:00,4
35
+ 0,1,2014-01-02,10:00,4"""
36
+ parser = all_parsers
37
+ parse_dates = [[1, 2]]
38
+
39
+ cols = {
40
+ "a": [0, 0],
41
+ "c_d": [Timestamp("2014-01-01 09:00:00"), Timestamp("2014-01-02 10:00:00")],
42
+ }
43
+ expected = DataFrame(cols, columns=["c_d", "a"])
44
+ result = parser.read_csv(StringIO(data), usecols=usecols, parse_dates=parse_dates)
45
+ tm.assert_frame_equal(result, expected)
46
+
47
+
48
+ def test_usecols_with_parse_dates2(all_parsers):
49
+ # see gh-13604
50
+ parser = all_parsers
51
+ data = """2008-02-07 09:40,1032.43
52
+ 2008-02-07 09:50,1042.54
53
+ 2008-02-07 10:00,1051.65"""
54
+
55
+ names = ["date", "values"]
56
+ usecols = names[:]
57
+ parse_dates = [0]
58
+
59
+ index = Index(
60
+ [
61
+ Timestamp("2008-02-07 09:40"),
62
+ Timestamp("2008-02-07 09:50"),
63
+ Timestamp("2008-02-07 10:00"),
64
+ ],
65
+ name="date",
66
+ )
67
+ cols = {"values": [1032.43, 1042.54, 1051.65]}
68
+ expected = DataFrame(cols, index=index)
69
+
70
+ result = parser.read_csv(
71
+ StringIO(data),
72
+ parse_dates=parse_dates,
73
+ index_col=0,
74
+ usecols=usecols,
75
+ header=None,
76
+ names=names,
77
+ )
78
+ tm.assert_frame_equal(result, expected)
79
+
80
+
81
+ def test_usecols_with_parse_dates3(all_parsers):
82
+ # see gh-14792
83
+ parser = all_parsers
84
+ data = """a,b,c,d,e,f,g,h,i,j
85
+ 2016/09/21,1,1,2,3,4,5,6,7,8"""
86
+
87
+ usecols = list("abcdefghij")
88
+ parse_dates = [0]
89
+
90
+ cols = {
91
+ "a": Timestamp("2016-09-21"),
92
+ "b": [1],
93
+ "c": [1],
94
+ "d": [2],
95
+ "e": [3],
96
+ "f": [4],
97
+ "g": [5],
98
+ "h": [6],
99
+ "i": [7],
100
+ "j": [8],
101
+ }
102
+ expected = DataFrame(cols, columns=usecols)
103
+
104
+ result = parser.read_csv(StringIO(data), usecols=usecols, parse_dates=parse_dates)
105
+ tm.assert_frame_equal(result, expected)
106
+
107
+
108
+ def test_usecols_with_parse_dates4(all_parsers):
109
+ data = "a,b,c,d,e,f,g,h,i,j\n2016/09/21,1,1,2,3,4,5,6,7,8"
110
+ usecols = list("abcdefghij")
111
+ parse_dates = [[0, 1]]
112
+ parser = all_parsers
113
+
114
+ cols = {
115
+ "a_b": "2016/09/21 1",
116
+ "c": [1],
117
+ "d": [2],
118
+ "e": [3],
119
+ "f": [4],
120
+ "g": [5],
121
+ "h": [6],
122
+ "i": [7],
123
+ "j": [8],
124
+ }
125
+ expected = DataFrame(cols, columns=["a_b"] + list("cdefghij"))
126
+
127
+ result = parser.read_csv(
128
+ StringIO(data),
129
+ usecols=usecols,
130
+ parse_dates=parse_dates,
131
+ )
132
+ tm.assert_frame_equal(result, expected)
133
+
134
+
135
+ @pytest.mark.parametrize("usecols", [[0, 2, 3], [3, 0, 2]])
136
+ @pytest.mark.parametrize(
137
+ "names",
138
+ [
139
+ list("abcde"), # Names span all columns in original data.
140
+ list("acd"), # Names span only the selected columns.
141
+ ],
142
+ )
143
+ def test_usecols_with_parse_dates_and_names(all_parsers, usecols, names):
144
+ # see gh-9755
145
+ s = """0,1,2014-01-01,09:00,4
146
+ 0,1,2014-01-02,10:00,4"""
147
+ parse_dates = [[1, 2]]
148
+ parser = all_parsers
149
+
150
+ cols = {
151
+ "a": [0, 0],
152
+ "c_d": [Timestamp("2014-01-01 09:00:00"), Timestamp("2014-01-02 10:00:00")],
153
+ }
154
+ expected = DataFrame(cols, columns=["c_d", "a"])
155
+
156
+ result = parser.read_csv(
157
+ StringIO(s), names=names, parse_dates=parse_dates, usecols=usecols
158
+ )
159
+ tm.assert_frame_equal(result, expected)
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/test_strings.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests the usecols functionality during parsing
3
+ for all of the parsers defined in parsers.py
4
+ """
5
+ from io import StringIO
6
+
7
+ import pytest
8
+
9
+ from pandas import DataFrame
10
+ import pandas._testing as tm
11
+
12
+ _msg_validate_usecols_arg = (
13
+ "'usecols' must either be list-like "
14
+ "of all strings, all unicode, all "
15
+ "integers or a callable."
16
+ )
17
+ _msg_validate_usecols_names = (
18
+ "Usecols do not match columns, columns expected but not found: {0}"
19
+ )
20
+
21
+
22
+ def test_usecols_with_unicode_strings(all_parsers):
23
+ # see gh-13219
24
+ data = """AAA,BBB,CCC,DDD
25
+ 0.056674973,8,True,a
26
+ 2.613230982,2,False,b
27
+ 3.568935038,7,False,a"""
28
+ parser = all_parsers
29
+
30
+ exp_data = {
31
+ "AAA": {
32
+ 0: 0.056674972999999997,
33
+ 1: 2.6132309819999997,
34
+ 2: 3.5689350380000002,
35
+ },
36
+ "BBB": {0: 8, 1: 2, 2: 7},
37
+ }
38
+ expected = DataFrame(exp_data)
39
+
40
+ result = parser.read_csv(StringIO(data), usecols=["AAA", "BBB"])
41
+ tm.assert_frame_equal(result, expected)
42
+
43
+
44
+ def test_usecols_with_single_byte_unicode_strings(all_parsers):
45
+ # see gh-13219
46
+ data = """A,B,C,D
47
+ 0.056674973,8,True,a
48
+ 2.613230982,2,False,b
49
+ 3.568935038,7,False,a"""
50
+ parser = all_parsers
51
+
52
+ exp_data = {
53
+ "A": {
54
+ 0: 0.056674972999999997,
55
+ 1: 2.6132309819999997,
56
+ 2: 3.5689350380000002,
57
+ },
58
+ "B": {0: 8, 1: 2, 2: 7},
59
+ }
60
+ expected = DataFrame(exp_data)
61
+
62
+ result = parser.read_csv(StringIO(data), usecols=["A", "B"])
63
+ tm.assert_frame_equal(result, expected)
64
+
65
+
66
+ @pytest.mark.parametrize("usecols", [["AAA", b"BBB"], [b"AAA", "BBB"]])
67
+ def test_usecols_with_mixed_encoding_strings(all_parsers, usecols):
68
+ data = """AAA,BBB,CCC,DDD
69
+ 0.056674973,8,True,a
70
+ 2.613230982,2,False,b
71
+ 3.568935038,7,False,a"""
72
+ parser = all_parsers
73
+
74
+ with pytest.raises(ValueError, match=_msg_validate_usecols_arg):
75
+ parser.read_csv(StringIO(data), usecols=usecols)
76
+
77
+
78
+ @pytest.mark.parametrize("usecols", [["あああ", "いい"], ["あああ", "いい"]])
79
+ def test_usecols_with_multi_byte_characters(all_parsers, usecols):
80
+ data = """あああ,いい,ううう,ええええ
81
+ 0.056674973,8,True,a
82
+ 2.613230982,2,False,b
83
+ 3.568935038,7,False,a"""
84
+ parser = all_parsers
85
+
86
+ exp_data = {
87
+ "あああ": {
88
+ 0: 0.056674972999999997,
89
+ 1: 2.6132309819999997,
90
+ 2: 3.5689350380000002,
91
+ },
92
+ "いい": {0: 8, 1: 2, 2: 7},
93
+ }
94
+ expected = DataFrame(exp_data)
95
+
96
+ result = parser.read_csv(StringIO(data), usecols=usecols)
97
+ tm.assert_frame_equal(result, expected)
videochat2/lib/python3.10/site-packages/pandas/tests/io/parser/usecols/test_usecols_basic.py ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests the usecols functionality during parsing
3
+ for all of the parsers defined in parsers.py
4
+ """
5
+ from io import StringIO
6
+
7
+ import numpy as np
8
+ import pytest
9
+
10
+ from pandas.errors import ParserError
11
+
12
+ from pandas import (
13
+ DataFrame,
14
+ Index,
15
+ )
16
+ import pandas._testing as tm
17
+
18
+ _msg_validate_usecols_arg = (
19
+ "'usecols' must either be list-like "
20
+ "of all strings, all unicode, all "
21
+ "integers or a callable."
22
+ )
23
+ _msg_validate_usecols_names = (
24
+ "Usecols do not match columns, columns expected but not found: {0}"
25
+ )
26
+
27
+ # TODO(1.4): Change to xfails at release time
28
+ pytestmark = pytest.mark.usefixtures("pyarrow_skip")
29
+
30
+
31
+ def test_raise_on_mixed_dtype_usecols(all_parsers):
32
+ # See gh-12678
33
+ data = """a,b,c
34
+ 1000,2000,3000
35
+ 4000,5000,6000
36
+ """
37
+ usecols = [0, "b", 2]
38
+ parser = all_parsers
39
+
40
+ with pytest.raises(ValueError, match=_msg_validate_usecols_arg):
41
+ parser.read_csv(StringIO(data), usecols=usecols)
42
+
43
+
44
+ @pytest.mark.parametrize("usecols", [(1, 2), ("b", "c")])
45
+ def test_usecols(all_parsers, usecols):
46
+ data = """\
47
+ a,b,c
48
+ 1,2,3
49
+ 4,5,6
50
+ 7,8,9
51
+ 10,11,12"""
52
+ parser = all_parsers
53
+ result = parser.read_csv(StringIO(data), usecols=usecols)
54
+
55
+ expected = DataFrame([[2, 3], [5, 6], [8, 9], [11, 12]], columns=["b", "c"])
56
+ tm.assert_frame_equal(result, expected)
57
+
58
+
59
+ def test_usecols_with_names(all_parsers):
60
+ data = """\
61
+ a,b,c
62
+ 1,2,3
63
+ 4,5,6
64
+ 7,8,9
65
+ 10,11,12"""
66
+ parser = all_parsers
67
+ names = ["foo", "bar"]
68
+ result = parser.read_csv(StringIO(data), names=names, usecols=[1, 2], header=0)
69
+
70
+ expected = DataFrame([[2, 3], [5, 6], [8, 9], [11, 12]], columns=names)
71
+ tm.assert_frame_equal(result, expected)
72
+
73
+
74
+ @pytest.mark.parametrize(
75
+ "names,usecols", [(["b", "c"], [1, 2]), (["a", "b", "c"], ["b", "c"])]
76
+ )
77
+ def test_usecols_relative_to_names(all_parsers, names, usecols):
78
+ data = """\
79
+ 1,2,3
80
+ 4,5,6
81
+ 7,8,9
82
+ 10,11,12"""
83
+ parser = all_parsers
84
+ result = parser.read_csv(StringIO(data), names=names, header=None, usecols=usecols)
85
+
86
+ expected = DataFrame([[2, 3], [5, 6], [8, 9], [11, 12]], columns=["b", "c"])
87
+ tm.assert_frame_equal(result, expected)
88
+
89
+
90
+ def test_usecols_relative_to_names2(all_parsers):
91
+ # see gh-5766
92
+ data = """\
93
+ 1,2,3
94
+ 4,5,6
95
+ 7,8,9
96
+ 10,11,12"""
97
+ parser = all_parsers
98
+ result = parser.read_csv(
99
+ StringIO(data), names=["a", "b"], header=None, usecols=[0, 1]
100
+ )
101
+
102
+ expected = DataFrame([[1, 2], [4, 5], [7, 8], [10, 11]], columns=["a", "b"])
103
+ tm.assert_frame_equal(result, expected)
104
+
105
+
106
+ def test_usecols_name_length_conflict(all_parsers):
107
+ data = """\
108
+ 1,2,3
109
+ 4,5,6
110
+ 7,8,9
111
+ 10,11,12"""
112
+ parser = all_parsers
113
+ msg = "Number of passed names did not match number of header fields in the file"
114
+
115
+ with pytest.raises(ValueError, match=msg):
116
+ parser.read_csv(StringIO(data), names=["a", "b"], header=None, usecols=[1])
117
+
118
+
119
+ def test_usecols_single_string(all_parsers):
120
+ # see gh-20558
121
+ parser = all_parsers
122
+ data = """foo, bar, baz
123
+ 1000, 2000, 3000
124
+ 4000, 5000, 6000"""
125
+
126
+ with pytest.raises(ValueError, match=_msg_validate_usecols_arg):
127
+ parser.read_csv(StringIO(data), usecols="foo")
128
+
129
+
130
+ @pytest.mark.parametrize(
131
+ "data", ["a,b,c,d\n1,2,3,4\n5,6,7,8", "a,b,c,d\n1,2,3,4,\n5,6,7,8,"]
132
+ )
133
+ def test_usecols_index_col_false(all_parsers, data):
134
+ # see gh-9082
135
+ parser = all_parsers
136
+ usecols = ["a", "c", "d"]
137
+ expected = DataFrame({"a": [1, 5], "c": [3, 7], "d": [4, 8]})
138
+
139
+ result = parser.read_csv(StringIO(data), usecols=usecols, index_col=False)
140
+ tm.assert_frame_equal(result, expected)
141
+
142
+
143
+ @pytest.mark.parametrize("index_col", ["b", 0])
144
+ @pytest.mark.parametrize("usecols", [["b", "c"], [1, 2]])
145
+ def test_usecols_index_col_conflict(all_parsers, usecols, index_col):
146
+ # see gh-4201: test that index_col as integer reflects usecols
147
+ parser = all_parsers
148
+ data = "a,b,c,d\nA,a,1,one\nB,b,2,two"
149
+ expected = DataFrame({"c": [1, 2]}, index=Index(["a", "b"], name="b"))
150
+
151
+ result = parser.read_csv(StringIO(data), usecols=usecols, index_col=index_col)
152
+ tm.assert_frame_equal(result, expected)
153
+
154
+
155
+ def test_usecols_index_col_conflict2(all_parsers):
156
+ # see gh-4201: test that index_col as integer reflects usecols
157
+ parser = all_parsers
158
+ data = "a,b,c,d\nA,a,1,one\nB,b,2,two"
159
+
160
+ expected = DataFrame({"b": ["a", "b"], "c": [1, 2], "d": ("one", "two")})
161
+ expected = expected.set_index(["b", "c"])
162
+
163
+ result = parser.read_csv(
164
+ StringIO(data), usecols=["b", "c", "d"], index_col=["b", "c"]
165
+ )
166
+ tm.assert_frame_equal(result, expected)
167
+
168
+
169
+ def test_usecols_implicit_index_col(all_parsers):
170
+ # see gh-2654
171
+ parser = all_parsers
172
+ data = "a,b,c\n4,apple,bat,5.7\n8,orange,cow,10"
173
+
174
+ result = parser.read_csv(StringIO(data), usecols=["a", "b"])
175
+ expected = DataFrame({"a": ["apple", "orange"], "b": ["bat", "cow"]}, index=[4, 8])
176
+ tm.assert_frame_equal(result, expected)
177
+
178
+
179
+ def test_usecols_index_col_middle(all_parsers):
180
+ # GH#9098
181
+ parser = all_parsers
182
+ data = """a,b,c,d
183
+ 1,2,3,4
184
+ """
185
+ result = parser.read_csv(StringIO(data), usecols=["b", "c", "d"], index_col="c")
186
+ expected = DataFrame({"b": [2], "d": [4]}, index=Index([3], name="c"))
187
+ tm.assert_frame_equal(result, expected)
188
+
189
+
190
+ def test_usecols_index_col_end(all_parsers):
191
+ # GH#9098
192
+ parser = all_parsers
193
+ data = """a,b,c,d
194
+ 1,2,3,4
195
+ """
196
+ result = parser.read_csv(StringIO(data), usecols=["b", "c", "d"], index_col="d")
197
+ expected = DataFrame({"b": [2], "c": [3]}, index=Index([4], name="d"))
198
+ tm.assert_frame_equal(result, expected)
199
+
200
+
201
+ def test_usecols_regex_sep(all_parsers):
202
+ # see gh-2733
203
+ parser = all_parsers
204
+ data = "a b c\n4 apple bat 5.7\n8 orange cow 10"
205
+ result = parser.read_csv(StringIO(data), sep=r"\s+", usecols=("a", "b"))
206
+
207
+ expected = DataFrame({"a": ["apple", "orange"], "b": ["bat", "cow"]}, index=[4, 8])
208
+ tm.assert_frame_equal(result, expected)
209
+
210
+
211
+ def test_usecols_with_whitespace(all_parsers):
212
+ parser = all_parsers
213
+ data = "a b c\n4 apple bat 5.7\n8 orange cow 10"
214
+
215
+ result = parser.read_csv(StringIO(data), delim_whitespace=True, usecols=("a", "b"))
216
+ expected = DataFrame({"a": ["apple", "orange"], "b": ["bat", "cow"]}, index=[4, 8])
217
+ tm.assert_frame_equal(result, expected)
218
+
219
+
220
+ @pytest.mark.parametrize(
221
+ "usecols,expected",
222
+ [
223
+ # Column selection by index.
224
+ ([0, 1], DataFrame(data=[[1000, 2000], [4000, 5000]], columns=["2", "0"])),
225
+ # Column selection by name.
226
+ (
227
+ ["0", "1"],
228
+ DataFrame(data=[[2000, 3000], [5000, 6000]], columns=["0", "1"]),
229
+ ),
230
+ ],
231
+ )
232
+ def test_usecols_with_integer_like_header(all_parsers, usecols, expected):
233
+ parser = all_parsers
234
+ data = """2,0,1
235
+ 1000,2000,3000
236
+ 4000,5000,6000"""
237
+
238
+ result = parser.read_csv(StringIO(data), usecols=usecols)
239
+ tm.assert_frame_equal(result, expected)
240
+
241
+
242
+ def test_empty_usecols(all_parsers):
243
+ data = "a,b,c\n1,2,3\n4,5,6"
244
+ expected = DataFrame(columns=Index([]))
245
+ parser = all_parsers
246
+
247
+ result = parser.read_csv(StringIO(data), usecols=set())
248
+ tm.assert_frame_equal(result, expected)
249
+
250
+
251
+ def test_np_array_usecols(all_parsers):
252
+ # see gh-12546
253
+ parser = all_parsers
254
+ data = "a,b,c\n1,2,3"
255
+ usecols = np.array(["a", "b"])
256
+
257
+ expected = DataFrame([[1, 2]], columns=usecols)
258
+ result = parser.read_csv(StringIO(data), usecols=usecols)
259
+ tm.assert_frame_equal(result, expected)
260
+
261
+
262
+ @pytest.mark.parametrize(
263
+ "usecols,expected",
264
+ [
265
+ (
266
+ lambda x: x.upper() in ["AAA", "BBB", "DDD"],
267
+ DataFrame(
268
+ {
269
+ "AaA": {
270
+ 0: 0.056674972999999997,
271
+ 1: 2.6132309819999997,
272
+ 2: 3.5689350380000002,
273
+ },
274
+ "bBb": {0: 8, 1: 2, 2: 7},
275
+ "ddd": {0: "a", 1: "b", 2: "a"},
276
+ }
277
+ ),
278
+ ),
279
+ (lambda x: False, DataFrame(columns=Index([]))),
280
+ ],
281
+ )
282
+ def test_callable_usecols(all_parsers, usecols, expected):
283
+ # see gh-14154
284
+ data = """AaA,bBb,CCC,ddd
285
+ 0.056674973,8,True,a
286
+ 2.613230982,2,False,b
287
+ 3.568935038,7,False,a"""
288
+ parser = all_parsers
289
+
290
+ result = parser.read_csv(StringIO(data), usecols=usecols)
291
+ tm.assert_frame_equal(result, expected)
292
+
293
+
294
+ @pytest.mark.parametrize("usecols", [["a", "c"], lambda x: x in ["a", "c"]])
295
+ def test_incomplete_first_row(all_parsers, usecols):
296
+ # see gh-6710
297
+ data = "1,2\n1,2,3"
298
+ parser = all_parsers
299
+ names = ["a", "b", "c"]
300
+ expected = DataFrame({"a": [1, 1], "c": [np.nan, 3]})
301
+
302
+ result = parser.read_csv(StringIO(data), names=names, usecols=usecols)
303
+ tm.assert_frame_equal(result, expected)
304
+
305
+
306
+ @pytest.mark.parametrize(
307
+ "data,usecols,kwargs,expected",
308
+ [
309
+ # see gh-8985
310
+ (
311
+ "19,29,39\n" * 2 + "10,20,30,40",
312
+ [0, 1, 2],
313
+ {"header": None},
314
+ DataFrame([[19, 29, 39], [19, 29, 39], [10, 20, 30]]),
315
+ ),
316
+ # see gh-9549
317
+ (
318
+ ("A,B,C\n1,2,3\n3,4,5\n1,2,4,5,1,6\n1,2,3,,,1,\n1,2,3\n5,6,7"),
319
+ ["A", "B", "C"],
320
+ {},
321
+ DataFrame(
322
+ {
323
+ "A": [1, 3, 1, 1, 1, 5],
324
+ "B": [2, 4, 2, 2, 2, 6],
325
+ "C": [3, 5, 4, 3, 3, 7],
326
+ }
327
+ ),
328
+ ),
329
+ ],
330
+ )
331
+ def test_uneven_length_cols(all_parsers, data, usecols, kwargs, expected):
332
+ # see gh-8985
333
+ parser = all_parsers
334
+ result = parser.read_csv(StringIO(data), usecols=usecols, **kwargs)
335
+ tm.assert_frame_equal(result, expected)
336
+
337
+
338
+ @pytest.mark.parametrize(
339
+ "usecols,kwargs,expected,msg",
340
+ [
341
+ (
342
+ ["a", "b", "c", "d"],
343
+ {},
344
+ DataFrame({"a": [1, 5], "b": [2, 6], "c": [3, 7], "d": [4, 8]}),
345
+ None,
346
+ ),
347
+ (
348
+ ["a", "b", "c", "f"],
349
+ {},
350
+ None,
351
+ _msg_validate_usecols_names.format(r"\['f'\]"),
352
+ ),
353
+ (["a", "b", "f"], {}, None, _msg_validate_usecols_names.format(r"\['f'\]")),
354
+ (
355
+ ["a", "b", "f", "g"],
356
+ {},
357
+ None,
358
+ _msg_validate_usecols_names.format(r"\[('f', 'g'|'g', 'f')\]"),
359
+ ),
360
+ # see gh-14671
361
+ (
362
+ None,
363
+ {"header": 0, "names": ["A", "B", "C", "D"]},
364
+ DataFrame({"A": [1, 5], "B": [2, 6], "C": [3, 7], "D": [4, 8]}),
365
+ None,
366
+ ),
367
+ (
368
+ ["A", "B", "C", "f"],
369
+ {"header": 0, "names": ["A", "B", "C", "D"]},
370
+ None,
371
+ _msg_validate_usecols_names.format(r"\['f'\]"),
372
+ ),
373
+ (
374
+ ["A", "B", "f"],
375
+ {"names": ["A", "B", "C", "D"]},
376
+ None,
377
+ _msg_validate_usecols_names.format(r"\['f'\]"),
378
+ ),
379
+ ],
380
+ )
381
+ def test_raises_on_usecols_names_mismatch(all_parsers, usecols, kwargs, expected, msg):
382
+ data = "a,b,c,d\n1,2,3,4\n5,6,7,8"
383
+ kwargs.update(usecols=usecols)
384
+ parser = all_parsers
385
+
386
+ if expected is None:
387
+ with pytest.raises(ValueError, match=msg):
388
+ parser.read_csv(StringIO(data), **kwargs)
389
+ else:
390
+ result = parser.read_csv(StringIO(data), **kwargs)
391
+ tm.assert_frame_equal(result, expected)
392
+
393
+
394
+ @pytest.mark.parametrize("usecols", [["A", "C"], [0, 2]])
395
+ def test_usecols_subset_names_mismatch_orig_columns(all_parsers, usecols):
396
+ data = "a,b,c,d\n1,2,3,4\n5,6,7,8"
397
+ names = ["A", "B", "C", "D"]
398
+ parser = all_parsers
399
+
400
+ result = parser.read_csv(StringIO(data), header=0, names=names, usecols=usecols)
401
+ expected = DataFrame({"A": [1, 5], "C": [3, 7]})
402
+ tm.assert_frame_equal(result, expected)
403
+
404
+
405
+ @pytest.mark.parametrize("names", [None, ["a", "b"]])
406
+ def test_usecols_indices_out_of_bounds(all_parsers, names):
407
+ # GH#25623 & GH 41130; enforced in 2.0
408
+ parser = all_parsers
409
+ data = """
410
+ a,b
411
+ 1,2
412
+ """
413
+ with pytest.raises(ParserError, match="Defining usecols without of bounds"):
414
+ parser.read_csv(StringIO(data), usecols=[0, 2], names=names, header=0)
415
+
416
+
417
+ def test_usecols_additional_columns(all_parsers):
418
+ # GH#46997
419
+ parser = all_parsers
420
+ usecols = lambda header: header.strip() in ["a", "b", "c"]
421
+ result = parser.read_csv(StringIO("a,b\nx,y,z"), index_col=False, usecols=usecols)
422
+ expected = DataFrame({"a": ["x"], "b": "y"})
423
+ tm.assert_frame_equal(result, expected)
424
+
425
+
426
+ def test_usecols_additional_columns_integer_columns(all_parsers):
427
+ # GH#46997
428
+ parser = all_parsers
429
+ usecols = lambda header: header.strip() in ["0", "1"]
430
+ result = parser.read_csv(StringIO("0,1\nx,y,z"), index_col=False, usecols=usecols)
431
+ expected = DataFrame({"0": ["x"], "1": "y"})
432
+ tm.assert_frame_equal(result, expected)
videochat2/lib/python3.10/site-packages/pandas/tests/util/__init__.py ADDED
File without changes
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_attr_equal.cpython-310.pyc ADDED
Binary file (1.02 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_extension_array_equal.cpython-310.pyc ADDED
Binary file (3.43 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_frame_equal.cpython-310.pyc ADDED
Binary file (11.3 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_index_equal.cpython-310.pyc ADDED
Binary file (8.93 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_interval_array_equal.cpython-310.pyc ADDED
Binary file (2.15 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_numpy_array_equal.cpython-310.pyc ADDED
Binary file (6.61 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_produces_warning.cpython-310.pyc ADDED
Binary file (8.1 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_assert_series_equal.cpython-310.pyc ADDED
Binary file (12 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_deprecate.cpython-310.pyc ADDED
Binary file (2.17 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_deprecate_kwarg.cpython-310.pyc ADDED
Binary file (3.11 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_doc.cpython-310.pyc ADDED
Binary file (1.97 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_hashing.cpython-310.pyc ADDED
Binary file (11.1 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_make_objects.cpython-310.pyc ADDED
Binary file (534 Bytes). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_numba.cpython-310.pyc ADDED
Binary file (681 Bytes). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_rewrite_warning.cpython-310.pyc ADDED
Binary file (1.08 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_show_versions.cpython-310.pyc ADDED
Binary file (1.72 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_str_methods.cpython-310.pyc ADDED
Binary file (1.06 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_validate_args_and_kwargs.cpython-310.pyc ADDED
Binary file (2.27 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/__pycache__/test_validate_inclusive.cpython-310.pyc ADDED
Binary file (1.03 kB). View file
 
videochat2/lib/python3.10/site-packages/pandas/tests/util/conftest.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+
4
+ @pytest.fixture(params=[True, False])
5
+ def check_dtype(request):
6
+ return request.param
7
+
8
+
9
+ @pytest.fixture(params=[True, False])
10
+ def check_exact(request):
11
+ return request.param
12
+
13
+
14
+ @pytest.fixture(params=[True, False])
15
+ def check_index_type(request):
16
+ return request.param
17
+
18
+
19
+ @pytest.fixture(params=[0.5e-3, 0.5e-5])
20
+ def rtol(request):
21
+ return request.param
22
+
23
+
24
+ @pytest.fixture(params=[True, False])
25
+ def check_categorical(request):
26
+ return request.param
videochat2/lib/python3.10/site-packages/pandas/tests/util/test_assert_almost_equal.py ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from pandas import (
5
+ DataFrame,
6
+ Index,
7
+ Series,
8
+ Timestamp,
9
+ )
10
+ import pandas._testing as tm
11
+
12
+
13
+ def _assert_almost_equal_both(a, b, **kwargs):
14
+ """
15
+ Check that two objects are approximately equal.
16
+
17
+ This check is performed commutatively.
18
+
19
+ Parameters
20
+ ----------
21
+ a : object
22
+ The first object to compare.
23
+ b : object
24
+ The second object to compare.
25
+ **kwargs
26
+ The arguments passed to `tm.assert_almost_equal`.
27
+ """
28
+ tm.assert_almost_equal(a, b, **kwargs)
29
+ tm.assert_almost_equal(b, a, **kwargs)
30
+
31
+
32
+ def _assert_not_almost_equal(a, b, **kwargs):
33
+ """
34
+ Check that two objects are not approximately equal.
35
+
36
+ Parameters
37
+ ----------
38
+ a : object
39
+ The first object to compare.
40
+ b : object
41
+ The second object to compare.
42
+ **kwargs
43
+ The arguments passed to `tm.assert_almost_equal`.
44
+ """
45
+ try:
46
+ tm.assert_almost_equal(a, b, **kwargs)
47
+ msg = f"{a} and {b} were approximately equal when they shouldn't have been"
48
+ pytest.fail(msg=msg)
49
+ except AssertionError:
50
+ pass
51
+
52
+
53
+ def _assert_not_almost_equal_both(a, b, **kwargs):
54
+ """
55
+ Check that two objects are not approximately equal.
56
+
57
+ This check is performed commutatively.
58
+
59
+ Parameters
60
+ ----------
61
+ a : object
62
+ The first object to compare.
63
+ b : object
64
+ The second object to compare.
65
+ **kwargs
66
+ The arguments passed to `tm.assert_almost_equal`.
67
+ """
68
+ _assert_not_almost_equal(a, b, **kwargs)
69
+ _assert_not_almost_equal(b, a, **kwargs)
70
+
71
+
72
+ @pytest.mark.parametrize(
73
+ "a,b",
74
+ [
75
+ (1.1, 1.1),
76
+ (1.1, 1.100001),
77
+ (np.int16(1), 1.000001),
78
+ (np.float64(1.1), 1.1),
79
+ (np.uint32(5), 5),
80
+ ],
81
+ )
82
+ def test_assert_almost_equal_numbers(a, b):
83
+ _assert_almost_equal_both(a, b)
84
+
85
+
86
+ @pytest.mark.parametrize(
87
+ "a,b",
88
+ [
89
+ (1.1, 1),
90
+ (1.1, True),
91
+ (1, 2),
92
+ (1.0001, np.int16(1)),
93
+ # The following two examples are not "almost equal" due to tol.
94
+ (0.1, 0.1001),
95
+ (0.0011, 0.0012),
96
+ ],
97
+ )
98
+ def test_assert_not_almost_equal_numbers(a, b):
99
+ _assert_not_almost_equal_both(a, b)
100
+
101
+
102
+ @pytest.mark.parametrize(
103
+ "a,b",
104
+ [
105
+ (1.1, 1.1),
106
+ (1.1, 1.100001),
107
+ (1.1, 1.1001),
108
+ (0.000001, 0.000005),
109
+ (1000.0, 1000.0005),
110
+ # Testing this example, as per #13357
111
+ (0.000011, 0.000012),
112
+ ],
113
+ )
114
+ def test_assert_almost_equal_numbers_atol(a, b):
115
+ # Equivalent to the deprecated check_less_precise=True, enforced in 2.0
116
+ _assert_almost_equal_both(a, b, rtol=0.5e-3, atol=0.5e-3)
117
+
118
+
119
+ @pytest.mark.parametrize("a,b", [(1.1, 1.11), (0.1, 0.101), (0.000011, 0.001012)])
120
+ def test_assert_not_almost_equal_numbers_atol(a, b):
121
+ _assert_not_almost_equal_both(a, b, atol=1e-3)
122
+
123
+
124
+ @pytest.mark.parametrize(
125
+ "a,b",
126
+ [
127
+ (1.1, 1.1),
128
+ (1.1, 1.100001),
129
+ (1.1, 1.1001),
130
+ (1000.0, 1000.0005),
131
+ (1.1, 1.11),
132
+ (0.1, 0.101),
133
+ ],
134
+ )
135
+ def test_assert_almost_equal_numbers_rtol(a, b):
136
+ _assert_almost_equal_both(a, b, rtol=0.05)
137
+
138
+
139
+ @pytest.mark.parametrize("a,b", [(0.000011, 0.000012), (0.000001, 0.000005)])
140
+ def test_assert_not_almost_equal_numbers_rtol(a, b):
141
+ _assert_not_almost_equal_both(a, b, rtol=0.05)
142
+
143
+
144
+ @pytest.mark.parametrize(
145
+ "a,b,rtol",
146
+ [
147
+ (1.00001, 1.00005, 0.001),
148
+ (-0.908356 + 0.2j, -0.908358 + 0.2j, 1e-3),
149
+ (0.1 + 1.009j, 0.1 + 1.006j, 0.1),
150
+ (0.1001 + 2.0j, 0.1 + 2.001j, 0.01),
151
+ ],
152
+ )
153
+ def test_assert_almost_equal_complex_numbers(a, b, rtol):
154
+ _assert_almost_equal_both(a, b, rtol=rtol)
155
+ _assert_almost_equal_both(np.complex64(a), np.complex64(b), rtol=rtol)
156
+ _assert_almost_equal_both(np.complex128(a), np.complex128(b), rtol=rtol)
157
+
158
+
159
+ @pytest.mark.parametrize(
160
+ "a,b,rtol",
161
+ [
162
+ (0.58310768, 0.58330768, 1e-7),
163
+ (-0.908 + 0.2j, -0.978 + 0.2j, 0.001),
164
+ (0.1 + 1j, 0.1 + 2j, 0.01),
165
+ (-0.132 + 1.001j, -0.132 + 1.005j, 1e-5),
166
+ (0.58310768j, 0.58330768j, 1e-9),
167
+ ],
168
+ )
169
+ def test_assert_not_almost_equal_complex_numbers(a, b, rtol):
170
+ _assert_not_almost_equal_both(a, b, rtol=rtol)
171
+ _assert_not_almost_equal_both(np.complex64(a), np.complex64(b), rtol=rtol)
172
+ _assert_not_almost_equal_both(np.complex128(a), np.complex128(b), rtol=rtol)
173
+
174
+
175
+ @pytest.mark.parametrize("a,b", [(0, 0), (0, 0.0), (0, np.float64(0)), (0.00000001, 0)])
176
+ def test_assert_almost_equal_numbers_with_zeros(a, b):
177
+ _assert_almost_equal_both(a, b)
178
+
179
+
180
+ @pytest.mark.parametrize("a,b", [(0.001, 0), (1, 0)])
181
+ def test_assert_not_almost_equal_numbers_with_zeros(a, b):
182
+ _assert_not_almost_equal_both(a, b)
183
+
184
+
185
+ @pytest.mark.parametrize("a,b", [(1, "abc"), (1, [1]), (1, object())])
186
+ def test_assert_not_almost_equal_numbers_with_mixed(a, b):
187
+ _assert_not_almost_equal_both(a, b)
188
+
189
+
190
+ @pytest.mark.parametrize(
191
+ "left_dtype", ["M8[ns]", "m8[ns]", "float64", "int64", "object"]
192
+ )
193
+ @pytest.mark.parametrize(
194
+ "right_dtype", ["M8[ns]", "m8[ns]", "float64", "int64", "object"]
195
+ )
196
+ def test_assert_almost_equal_edge_case_ndarrays(left_dtype, right_dtype):
197
+ # Empty compare.
198
+ _assert_almost_equal_both(
199
+ np.array([], dtype=left_dtype),
200
+ np.array([], dtype=right_dtype),
201
+ check_dtype=False,
202
+ )
203
+
204
+
205
+ def test_assert_almost_equal_dicts():
206
+ _assert_almost_equal_both({"a": 1, "b": 2}, {"a": 1, "b": 2})
207
+
208
+
209
+ @pytest.mark.parametrize(
210
+ "a,b",
211
+ [
212
+ ({"a": 1, "b": 2}, {"a": 1, "b": 3}),
213
+ ({"a": 1, "b": 2}, {"a": 1, "b": 2, "c": 3}),
214
+ ({"a": 1}, 1),
215
+ ({"a": 1}, "abc"),
216
+ ({"a": 1}, [1]),
217
+ ],
218
+ )
219
+ def test_assert_not_almost_equal_dicts(a, b):
220
+ _assert_not_almost_equal_both(a, b)
221
+
222
+
223
+ @pytest.mark.parametrize("val", [1, 2])
224
+ def test_assert_almost_equal_dict_like_object(val):
225
+ dict_val = 1
226
+ real_dict = {"a": val}
227
+
228
+ class DictLikeObj:
229
+ def keys(self):
230
+ return ("a",)
231
+
232
+ def __getitem__(self, item):
233
+ if item == "a":
234
+ return dict_val
235
+
236
+ func = (
237
+ _assert_almost_equal_both if val == dict_val else _assert_not_almost_equal_both
238
+ )
239
+ func(real_dict, DictLikeObj(), check_dtype=False)
240
+
241
+
242
+ def test_assert_almost_equal_strings():
243
+ _assert_almost_equal_both("abc", "abc")
244
+
245
+
246
+ @pytest.mark.parametrize(
247
+ "a,b", [("abc", "abcd"), ("abc", "abd"), ("abc", 1), ("abc", [1])]
248
+ )
249
+ def test_assert_not_almost_equal_strings(a, b):
250
+ _assert_not_almost_equal_both(a, b)
251
+
252
+
253
+ @pytest.mark.parametrize(
254
+ "a,b", [([1, 2, 3], [1, 2, 3]), (np.array([1, 2, 3]), np.array([1, 2, 3]))]
255
+ )
256
+ def test_assert_almost_equal_iterables(a, b):
257
+ _assert_almost_equal_both(a, b)
258
+
259
+
260
+ @pytest.mark.parametrize(
261
+ "a,b",
262
+ [
263
+ # Class is different.
264
+ (np.array([1, 2, 3]), [1, 2, 3]),
265
+ # Dtype is different.
266
+ (np.array([1, 2, 3]), np.array([1.0, 2.0, 3.0])),
267
+ # Can't compare generators.
268
+ (iter([1, 2, 3]), [1, 2, 3]),
269
+ ([1, 2, 3], [1, 2, 4]),
270
+ ([1, 2, 3], [1, 2, 3, 4]),
271
+ ([1, 2, 3], 1),
272
+ ],
273
+ )
274
+ def test_assert_not_almost_equal_iterables(a, b):
275
+ _assert_not_almost_equal(a, b)
276
+
277
+
278
+ def test_assert_almost_equal_null():
279
+ _assert_almost_equal_both(None, None)
280
+
281
+
282
+ @pytest.mark.parametrize("a,b", [(None, np.NaN), (None, 0), (np.NaN, 0)])
283
+ def test_assert_not_almost_equal_null(a, b):
284
+ _assert_not_almost_equal(a, b)
285
+
286
+
287
+ @pytest.mark.parametrize(
288
+ "a,b",
289
+ [
290
+ (np.inf, np.inf),
291
+ (np.inf, float("inf")),
292
+ (np.array([np.inf, np.nan, -np.inf]), np.array([np.inf, np.nan, -np.inf])),
293
+ (
294
+ np.array([np.inf, None, -np.inf], dtype=np.object_),
295
+ np.array([np.inf, np.nan, -np.inf], dtype=np.object_),
296
+ ),
297
+ ],
298
+ )
299
+ def test_assert_almost_equal_inf(a, b):
300
+ _assert_almost_equal_both(a, b)
301
+
302
+
303
+ def test_assert_not_almost_equal_inf():
304
+ _assert_not_almost_equal_both(np.inf, 0)
305
+
306
+
307
+ @pytest.mark.parametrize(
308
+ "a,b",
309
+ [
310
+ (Index([1.0, 1.1]), Index([1.0, 1.100001])),
311
+ (Series([1.0, 1.1]), Series([1.0, 1.100001])),
312
+ (np.array([1.1, 2.000001]), np.array([1.1, 2.0])),
313
+ (DataFrame({"a": [1.0, 1.1]}), DataFrame({"a": [1.0, 1.100001]})),
314
+ ],
315
+ )
316
+ def test_assert_almost_equal_pandas(a, b):
317
+ _assert_almost_equal_both(a, b)
318
+
319
+
320
+ def test_assert_almost_equal_object():
321
+ a = [Timestamp("2011-01-01"), Timestamp("2011-01-01")]
322
+ b = [Timestamp("2011-01-01"), Timestamp("2011-01-01")]
323
+ _assert_almost_equal_both(a, b)
324
+
325
+
326
+ def test_assert_almost_equal_value_mismatch():
327
+ msg = "expected 2\\.00000 but got 1\\.00000, with rtol=1e-05, atol=1e-08"
328
+
329
+ with pytest.raises(AssertionError, match=msg):
330
+ tm.assert_almost_equal(1, 2)
331
+
332
+
333
+ @pytest.mark.parametrize(
334
+ "a,b,klass1,klass2",
335
+ [(np.array([1]), 1, "ndarray", "int"), (1, np.array([1]), "int", "ndarray")],
336
+ )
337
+ def test_assert_almost_equal_class_mismatch(a, b, klass1, klass2):
338
+ msg = f"""numpy array are different
339
+
340
+ numpy array classes are different
341
+ \\[left\\]: {klass1}
342
+ \\[right\\]: {klass2}"""
343
+
344
+ with pytest.raises(AssertionError, match=msg):
345
+ tm.assert_almost_equal(a, b)
346
+
347
+
348
+ def test_assert_almost_equal_value_mismatch1():
349
+ msg = """numpy array are different
350
+
351
+ numpy array values are different \\(66\\.66667 %\\)
352
+ \\[left\\]: \\[nan, 2\\.0, 3\\.0\\]
353
+ \\[right\\]: \\[1\\.0, nan, 3\\.0\\]"""
354
+
355
+ with pytest.raises(AssertionError, match=msg):
356
+ tm.assert_almost_equal(np.array([np.nan, 2, 3]), np.array([1, np.nan, 3]))
357
+
358
+
359
+ def test_assert_almost_equal_value_mismatch2():
360
+ msg = """numpy array are different
361
+
362
+ numpy array values are different \\(50\\.0 %\\)
363
+ \\[left\\]: \\[1, 2\\]
364
+ \\[right\\]: \\[1, 3\\]"""
365
+
366
+ with pytest.raises(AssertionError, match=msg):
367
+ tm.assert_almost_equal(np.array([1, 2]), np.array([1, 3]))
368
+
369
+
370
+ def test_assert_almost_equal_value_mismatch3():
371
+ msg = """numpy array are different
372
+
373
+ numpy array values are different \\(16\\.66667 %\\)
374
+ \\[left\\]: \\[\\[1, 2\\], \\[3, 4\\], \\[5, 6\\]\\]
375
+ \\[right\\]: \\[\\[1, 3\\], \\[3, 4\\], \\[5, 6\\]\\]"""
376
+
377
+ with pytest.raises(AssertionError, match=msg):
378
+ tm.assert_almost_equal(
379
+ np.array([[1, 2], [3, 4], [5, 6]]), np.array([[1, 3], [3, 4], [5, 6]])
380
+ )
381
+
382
+
383
+ def test_assert_almost_equal_value_mismatch4():
384
+ msg = """numpy array are different
385
+
386
+ numpy array values are different \\(25\\.0 %\\)
387
+ \\[left\\]: \\[\\[1, 2\\], \\[3, 4\\]\\]
388
+ \\[right\\]: \\[\\[1, 3\\], \\[3, 4\\]\\]"""
389
+
390
+ with pytest.raises(AssertionError, match=msg):
391
+ tm.assert_almost_equal(np.array([[1, 2], [3, 4]]), np.array([[1, 3], [3, 4]]))
392
+
393
+
394
+ def test_assert_almost_equal_shape_mismatch_override():
395
+ msg = """Index are different
396
+
397
+ Index shapes are different
398
+ \\[left\\]: \\(2L*,\\)
399
+ \\[right\\]: \\(3L*,\\)"""
400
+ with pytest.raises(AssertionError, match=msg):
401
+ tm.assert_almost_equal(np.array([1, 2]), np.array([3, 4, 5]), obj="Index")
402
+
403
+
404
+ def test_assert_almost_equal_unicode():
405
+ # see gh-20503
406
+ msg = """numpy array are different
407
+
408
+ numpy array values are different \\(33\\.33333 %\\)
409
+ \\[left\\]: \\[á, à, ä\\]
410
+ \\[right\\]: \\[á, à, å\\]"""
411
+
412
+ with pytest.raises(AssertionError, match=msg):
413
+ tm.assert_almost_equal(np.array(["á", "à", "ä"]), np.array(["á", "à", "å"]))
414
+
415
+
416
+ def test_assert_almost_equal_timestamp():
417
+ a = np.array([Timestamp("2011-01-01"), Timestamp("2011-01-01")])
418
+ b = np.array([Timestamp("2011-01-01"), Timestamp("2011-01-02")])
419
+
420
+ msg = """numpy array are different
421
+
422
+ numpy array values are different \\(50\\.0 %\\)
423
+ \\[left\\]: \\[2011-01-01 00:00:00, 2011-01-01 00:00:00\\]
424
+ \\[right\\]: \\[2011-01-01 00:00:00, 2011-01-02 00:00:00\\]"""
425
+
426
+ with pytest.raises(AssertionError, match=msg):
427
+ tm.assert_almost_equal(a, b)
428
+
429
+
430
+ def test_assert_almost_equal_iterable_length_mismatch():
431
+ msg = """Iterable are different
432
+
433
+ Iterable length are different
434
+ \\[left\\]: 2
435
+ \\[right\\]: 3"""
436
+
437
+ with pytest.raises(AssertionError, match=msg):
438
+ tm.assert_almost_equal([1, 2], [3, 4, 5])
439
+
440
+
441
+ def test_assert_almost_equal_iterable_values_mismatch():
442
+ msg = """Iterable are different
443
+
444
+ Iterable values are different \\(50\\.0 %\\)
445
+ \\[left\\]: \\[1, 2\\]
446
+ \\[right\\]: \\[1, 3\\]"""
447
+
448
+ with pytest.raises(AssertionError, match=msg):
449
+ tm.assert_almost_equal([1, 2], [1, 3])
450
+
451
+
452
+ subarr = np.empty(2, dtype=object)
453
+ subarr[:] = [np.array([None, "b"], dtype=object), np.array(["c", "d"], dtype=object)]
454
+
455
+ NESTED_CASES = [
456
+ # nested array
457
+ (
458
+ np.array([np.array([50, 70, 90]), np.array([20, 30])], dtype=object),
459
+ np.array([np.array([50, 70, 90]), np.array([20, 30])], dtype=object),
460
+ ),
461
+ # >1 level of nesting
462
+ (
463
+ np.array(
464
+ [
465
+ np.array([np.array([50, 70]), np.array([90])], dtype=object),
466
+ np.array([np.array([20, 30])], dtype=object),
467
+ ],
468
+ dtype=object,
469
+ ),
470
+ np.array(
471
+ [
472
+ np.array([np.array([50, 70]), np.array([90])], dtype=object),
473
+ np.array([np.array([20, 30])], dtype=object),
474
+ ],
475
+ dtype=object,
476
+ ),
477
+ ),
478
+ # lists
479
+ (
480
+ np.array([[50, 70, 90], [20, 30]], dtype=object),
481
+ np.array([[50, 70, 90], [20, 30]], dtype=object),
482
+ ),
483
+ # mixed array/list
484
+ (
485
+ np.array([np.array([1, 2, 3]), np.array([4, 5])], dtype=object),
486
+ np.array([[1, 2, 3], [4, 5]], dtype=object),
487
+ ),
488
+ (
489
+ np.array(
490
+ [
491
+ np.array([np.array([1, 2, 3]), np.array([4, 5])], dtype=object),
492
+ np.array(
493
+ [np.array([6]), np.array([7, 8]), np.array([9])], dtype=object
494
+ ),
495
+ ],
496
+ dtype=object,
497
+ ),
498
+ np.array([[[1, 2, 3], [4, 5]], [[6], [7, 8], [9]]], dtype=object),
499
+ ),
500
+ # same-length lists
501
+ (
502
+ np.array([subarr, None], dtype=object),
503
+ np.array([list([[None, "b"], ["c", "d"]]), None], dtype=object),
504
+ ),
505
+ # dicts
506
+ (
507
+ np.array([{"f1": 1, "f2": np.array(["a", "b"], dtype=object)}], dtype=object),
508
+ np.array([{"f1": 1, "f2": np.array(["a", "b"], dtype=object)}], dtype=object),
509
+ ),
510
+ (
511
+ np.array([{"f1": 1, "f2": np.array(["a", "b"], dtype=object)}], dtype=object),
512
+ np.array([{"f1": 1, "f2": ["a", "b"]}], dtype=object),
513
+ ),
514
+ # array/list of dicts
515
+ (
516
+ np.array(
517
+ [
518
+ np.array(
519
+ [{"f1": 1, "f2": np.array(["a", "b"], dtype=object)}], dtype=object
520
+ ),
521
+ np.array([], dtype=object),
522
+ ],
523
+ dtype=object,
524
+ ),
525
+ np.array([[{"f1": 1, "f2": ["a", "b"]}], []], dtype=object),
526
+ ),
527
+ ]
528
+
529
+
530
+ @pytest.mark.filterwarnings("ignore:elementwise comparison failed:DeprecationWarning")
531
+ @pytest.mark.parametrize("a,b", NESTED_CASES)
532
+ def test_assert_almost_equal_array_nested(a, b):
533
+ _assert_almost_equal_both(a, b)
videochat2/lib/python3.10/site-packages/pandas/tests/util/test_assert_attr_equal.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from types import SimpleNamespace
2
+
3
+ import pytest
4
+
5
+ from pandas.core.dtypes.common import is_float
6
+
7
+ import pandas._testing as tm
8
+
9
+
10
+ def test_assert_attr_equal(nulls_fixture):
11
+ obj = SimpleNamespace()
12
+ obj.na_value = nulls_fixture
13
+ tm.assert_attr_equal("na_value", obj, obj)
14
+
15
+
16
+ def test_assert_attr_equal_different_nulls(nulls_fixture, nulls_fixture2):
17
+ obj = SimpleNamespace()
18
+ obj.na_value = nulls_fixture
19
+
20
+ obj2 = SimpleNamespace()
21
+ obj2.na_value = nulls_fixture2
22
+
23
+ if nulls_fixture is nulls_fixture2:
24
+ tm.assert_attr_equal("na_value", obj, obj2)
25
+ elif is_float(nulls_fixture) and is_float(nulls_fixture2):
26
+ # we consider float("nan") and np.float64("nan") to be equivalent
27
+ tm.assert_attr_equal("na_value", obj, obj2)
28
+ elif type(nulls_fixture) is type(nulls_fixture2):
29
+ # e.g. Decimal("NaN")
30
+ tm.assert_attr_equal("na_value", obj, obj2)
31
+ else:
32
+ with pytest.raises(AssertionError, match='"na_value" are different'):
33
+ tm.assert_attr_equal("na_value", obj, obj2)