|
5 | 5 |
|
6 | 6 | @pytest.fixture
|
7 | 7 | 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 | + """ |
8 | 16 | return Path(__file__).parent.parent / "data" / "xml"
|
9 | 17 |
|
10 | 18 |
|
11 | 19 | @pytest.fixture
|
12 | 20 | 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 | + """ |
13 | 29 | return datapath(xml_data_path / "books.xml")
|
14 | 30 |
|
15 | 31 |
|
16 | 32 | @pytest.fixture
|
17 | 33 | 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 | + """ |
18 | 42 | return datapath(xml_data_path / "doc_ch_utf.xml")
|
19 | 43 |
|
20 | 44 |
|
21 | 45 | @pytest.fixture
|
22 | 46 | 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 | + """ |
23 | 55 | return datapath(xml_data_path / "baby_names.xml")
|
24 | 56 |
|
25 | 57 |
|
26 | 58 | @pytest.fixture
|
27 | 59 | 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 | + """ |
28 | 73 | return datapath(xml_data_path / "cta_rail_lines.kml")
|
29 | 74 |
|
30 | 75 |
|
31 | 76 | @pytest.fixture
|
32 | 77 | 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 | + """ |
33 | 89 | return datapath(xml_data_path / "flatten_doc.xsl")
|
34 | 90 |
|
35 | 91 |
|
36 | 92 | @pytest.fixture
|
37 | 93 | 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 | + """ |
38 | 105 | return datapath(xml_data_path / "row_field_output.xsl")
|
0 commit comments