Skip to content

Commit d8a8fde

Browse files
committed
fix: test
1 parent cf2008b commit d8a8fde

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/pyconverter/xml2py/ast_tree.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,8 +3020,6 @@ def py_docstring(self, custom_functions: CustomFunctions, warning_command_dict:
30203020
"""
30213021
xml_cmd = f"{self._terms['pn006p']} Command: `{self.name} <{self.url}>`_"
30223022

3023-
# ``warning_command_dict`` need to be added here
3024-
30253023
items = [self.short_desc, "", xml_cmd]
30263024

30273025
if self.name in warning_command_dict.keys():

src/pyconverter/xml2py/load_xml_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def grab_links(linkmap):
109109
if targetptr is not None and href is not None:
110110
text = ""
111111
if linkmap[0].tag == "ttl":
112-
text = str(linkmap[0])
112+
text = str(linkmap[0]).strip()
113113
links[f"{targetptr}"] = (root_name, root_title, href, text)
114114

115115
grab_links(linkmap)

tests/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from pyconverter.xml2py.custom_functions import CustomFunctions
2727
import pyconverter.xml2py.directory_format as ff
2828
import pyconverter.xml2py.load_xml_doc as lxd
29-
from pyconverter.xml2py.utils.utils import get_config_data_value
29+
from pyconverter.xml2py.utils.utils import get_config_data_value, get_warning_command_dict
3030
import pyconverter.xml2py.writer as wrt
3131
import pytest
3232

@@ -142,3 +142,8 @@ def library_name_structured(config_path):
142142
@pytest.fixture
143143
def package_structure(command_map, name_map, directory_path, cwd, path_custom_functions):
144144
return wrt.write_source(command_map, name_map, directory_path, cwd, path_custom_functions)
145+
146+
147+
@pytest.fixture
148+
def warning_command_dict(config_path):
149+
return get_warning_command_dict(config_path)

tests/test_writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import pytest
2727

2828

29-
def test_convert(command_map, custom_functions):
29+
def test_convert(command_map, custom_functions, warning_command_dict):
3030
assert command_map["/XFRM"].name == "/XFRM"
3131
assert (
3232
"Original command: WRITE\n\nShort Description:\nWrites the radiation matrix file.\n\nFunction signature:\nWRITE," # noqa : E501
@@ -39,9 +39,9 @@ def test_convert(command_map, custom_functions):
3939
assert 'def zoom(self, wn: str = "", lab: str = "", x1: str = "", y1: str = "", x2: str = "", y2: str = "", **kwargs):\n r"""Zooms a region of a display window.\n\n' in command_map[ # noqa : E501
4040
"/ZOOM"
4141
].to_python(
42-
custom_functions
42+
custom_functions, warning_command_dict
4343
)
44-
assert "import re" in command_map["K"].to_python(custom_functions)
44+
assert "import re" in command_map["K"].to_python(custom_functions, warning_command_dict)
4545

4646

4747
def test_copy_template_package(cwd):

tests/test_xml_ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
@pytest.mark.parametrize(
2929
"initial_name,expected_output",
30-
[("/PREP7", "prep7"), ("*DMAT", "dmat"), ("SORT", "sort"), ("*GO", "stargo")],
30+
[("/PREP7", "prep7"), ("*DMAT", "dmat"), ("SORT", "sort"), ("*VPLOT", "starvplot")],
3131
)
3232
def test_py_name(initial_name, expected_output, name_map):
3333
assert ast.to_py_name(initial_name, name_map) == expected_output

0 commit comments

Comments
 (0)