Skip to content

Commit e6d0c1a

Browse files
authored
DOC: Added docstrings to fixtures defined in XML I/O, util and pandas modules (#56524)
1 parent 5789f15 commit e6d0c1a

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

pandas/conftest.py

+3
Original file line numberDiff line numberDiff line change
@@ -1973,4 +1973,7 @@ def warsaw(request) -> str:
19731973

19741974
@pytest.fixture
19751975
def arrow_string_storage():
1976+
"""
1977+
Fixture that lists possible PyArrow values for StringDtype storage field.
1978+
"""
19761979
return ("pyarrow", "pyarrow_numpy")

pandas/tests/io/xml/conftest.py

+67
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,101 @@
55

66
@pytest.fixture
77
def xml_data_path():
8+
"""
9+
Returns a Path object to the XML example directory.
10+
11+
Examples
12+
--------
13+
>>> def test_read_xml(xml_data_path):
14+
... read_xml(xml_data_path / 'file.xsl')
15+
"""
816
return Path(__file__).parent.parent / "data" / "xml"
917

1018

1119
@pytest.fixture
1220
def xml_books(xml_data_path, datapath):
21+
"""
22+
Returns the path (as `str`) to the `books.xml` example file.
23+
24+
Examples
25+
--------
26+
>>> def test_read_xml(xml_books):
27+
... read_xml(xml_books)
28+
"""
1329
return datapath(xml_data_path / "books.xml")
1430

1531

1632
@pytest.fixture
1733
def xml_doc_ch_utf(xml_data_path, datapath):
34+
"""
35+
Returns the path (as `str`) to the `doc_ch_utf.xml` example file.
36+
37+
Examples
38+
--------
39+
>>> def test_read_xml(xml_doc_ch_utf):
40+
... read_xml(xml_doc_ch_utf)
41+
"""
1842
return datapath(xml_data_path / "doc_ch_utf.xml")
1943

2044

2145
@pytest.fixture
2246
def xml_baby_names(xml_data_path, datapath):
47+
"""
48+
Returns the path (as `str`) to the `baby_names.xml` example file.
49+
50+
Examples
51+
--------
52+
>>> def test_read_xml(xml_baby_names):
53+
... read_xml(xml_baby_names)
54+
"""
2355
return datapath(xml_data_path / "baby_names.xml")
2456

2557

2658
@pytest.fixture
2759
def kml_cta_rail_lines(xml_data_path, datapath):
60+
"""
61+
Returns the path (as `str`) to the `cta_rail_lines.kml` example file.
62+
63+
Examples
64+
--------
65+
>>> def test_read_xml(kml_cta_rail_lines):
66+
... read_xml(
67+
... kml_cta_rail_lines,
68+
... xpath=".//k:Placemark",
69+
... namespaces={"k": "http://www.opengis.net/kml/2.2"},
70+
... stylesheet=xsl_flatten_doc,
71+
... )
72+
"""
2873
return datapath(xml_data_path / "cta_rail_lines.kml")
2974

3075

3176
@pytest.fixture
3277
def xsl_flatten_doc(xml_data_path, datapath):
78+
"""
79+
Returns the path (as `str`) to the `flatten_doc.xsl` example file.
80+
81+
Examples
82+
--------
83+
>>> def test_read_xsl(xsl_flatten_doc):
84+
... with open(
85+
... xsl_flatten_doc, mode, encoding="utf-8" if mode == "r" else None
86+
... ) as f:
87+
... xsl_obj = f.read()
88+
"""
3389
return datapath(xml_data_path / "flatten_doc.xsl")
3490

3591

3692
@pytest.fixture
3793
def xsl_row_field_output(xml_data_path, datapath):
94+
"""
95+
Returns the path (as `str`) to the `row_field_output.xsl` example file.
96+
97+
Examples
98+
--------
99+
>>> def test_read_xsl(xsl_row_field_output):
100+
... with open(
101+
... xsl_row_field_output, mode, encoding="utf-8" if mode == "r" else None
102+
... ) as f:
103+
... xsl_obj = f.read()
104+
"""
38105
return datapath(xml_data_path / "row_field_output.xsl")

pandas/tests/util/conftest.py

+20
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,44 @@
33

44
@pytest.fixture(params=[True, False])
55
def check_dtype(request):
6+
"""
7+
Fixture returning `True` or `False`, determining whether to check
8+
if the `dtype` is identical or not, when comparing two data structures,
9+
e.g. `Series`, `SparseArray` or `DataFrame`.
10+
"""
611
return request.param
712

813

914
@pytest.fixture(params=[True, False])
1015
def check_exact(request):
16+
"""
17+
Fixture returning `True` or `False`, determining whether to
18+
compare floating point numbers exactly or not.
19+
"""
1120
return request.param
1221

1322

1423
@pytest.fixture(params=[True, False])
1524
def check_index_type(request):
25+
"""
26+
Fixture returning `True` or `False`, determining whether to check
27+
if the `Index` types are identical or not.
28+
"""
1629
return request.param
1730

1831

1932
@pytest.fixture(params=[0.5e-3, 0.5e-5])
2033
def rtol(request):
34+
"""
35+
Fixture returning 0.5e-3 or 0.5e-5. Those values are used as relative tolerance.
36+
"""
2137
return request.param
2238

2339

2440
@pytest.fixture(params=[True, False])
2541
def check_categorical(request):
42+
"""
43+
Fixture returning `True` or `False`, determining whether to
44+
compare internal `Categorical` exactly or not.
45+
"""
2646
return request.param

0 commit comments

Comments
 (0)