Skip to content

Custom Object to XML Functionality with Tests#1

Open
olaf-c wants to merge 9 commits into
bagherilab:mainfrom
olaf-c:main
Open

Custom Object to XML Functionality with Tests#1
olaf-c wants to merge 9 commits into
bagherilab:mainfrom
olaf-c:main

Conversation

@olaf-c
Copy link
Copy Markdown
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
Comment thread tests/unit/test_ObjectToXML.py Outdated
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
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

Comment thread tests/unit/test_ObjectToXML.py Outdated
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
Copy Markdown
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

Comment thread tests/unit/test_ObjectToXML.py Outdated

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
Copy Markdown
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

Comment thread src/ObjectToXML.py Outdated
child_element = child.convert_to_element_tree()
element.append(child_element)
return element
def save_XML(self, file_name):
Copy link
Copy Markdown
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

Comment thread src/ObjectToXML.py Outdated
from typing import List

@dataclass(frozen=True, order=True)
class xml_object:
Copy link
Copy Markdown
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