Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Object to XML Functionality with Tests #1

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

olaf-c
Copy link
Collaborator

@olaf-c olaf-c commented Nov 21, 2023

Added files:

  • ObjectToXML.py under src
  • test_ObjectToXML.py under tests/unit
  • Relevant init.py files
  • Updated pyproject.toml

@cainja cainja self-requested a review November 22, 2023 21:51
self.tree_with_children.children[0].children.append(xml_object(name = 'population.process', attribute_dict = {'id':'SIGNALING', 'version':'complex'}, self_closing = True) )

print(self)
print("olaf")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure these debug print statements get removed before you send to pull request

self.assertEqual(children_elements[0].attrib, {'id':'DIVISION_POTENTIAL', 'value':'3'})

self.assertEqual(children_elements[1].tag, 'population.process')
self.assertEqual(children_elements[1].attrib, {'id':'METABOLISM', 'version':'complex'})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are cleaner ways to do this but we don't need to do that now


current_script_path = os.path.dirname(os.path.abspath(__file__))
relative_path_to_xml_object = os.path.normpath(os.path.join(current_script_path, '../../src/'))
sys.path.append(relative_path_to_xml_object)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flag to fix at another point

child_element = child.convert_to_element_tree()
element.append(child_element)
return element
def save_XML(self, file_name):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure you follow a style guide with spacing the methods

from typing import List

@dataclass(frozen=True, order=True)
class xml_object:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be camel case

…essary components in xml_object.py, uncertain how low level it should operate. Should it receive from gui.py strings or xml_objects.
… remade with PyQt Designer or another GUI designer. Functions required for creating final set up .xml located in xml_object.py and compile_xml.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants