Skip to content

add tests for gaphml with strict xml checks#218

Open
GREENRAT-K405 wants to merge 1 commit intoControlCore-Project:devfrom
GREENRAT-K405:feat/test-malformed-graph
Open

add tests for gaphml with strict xml checks#218
GREENRAT-K405 wants to merge 1 commit intoControlCore-Project:devfrom
GREENRAT-K405:feat/test-malformed-graph

Conversation

@GREENRAT-K405
Copy link

In this PR, I have added tests for graphml file in tests/test_graph.py:

  • test_validate_corrupted_xml: test for files with unclosed tags
  • test_validate_empty_file: test for empty file
  • test_validate_missing_root_element: incase there is XML file but it is not a graphml file
  • test_validate_missing_node_id: test for node id attributes
  • test_validate_missing_edgedefault
  • test_validate_broken_edges: test for cases like edge exists but the node is missing
  • test_validate_node_missing_filename: for test case like node exists but it isn't linked to any concore program
  • test_validate_valid_graph: test case for a perfectly minimal graphml file

the major changes in the validate.py:

  • added xml.etree.ElementTree to detect and report broken XML syntax immediately.
  • Added mandatory checks for:
    -- The edgedefault attribute on the element, it has to be directed or undirected.
    --The node "id" attribute on every , every node must have node id.
image

I have checked these test by building some dummy sample graphs:

  1. empty graph shows warning-> no nodes, no edges
image image
  1. graph with just node (no program attached with it) but no edge
image image
  1. image
image
  1. image
image
  1. image
image

@GREENRAT-K405
Copy link
Author

@pradeeban If anymore tests are required please do let me know.

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.

1 participant