Skip to content
Snippets Groups Projects
test_atom_format.py 865 B
Newer Older
  • Learn to ignore specific revisions
  • import unittest
    from formats.atom_format import is_valid
    
    
    class TestAtomFormat(unittest.TestCase):
        def test_is_valid__valid(self):
            resource = {}
            with open("tests/data/Atom_SH_Feldblockfinder_OpenGBD.xml", "r") as file:
                self.assertTrue(is_valid(resource, file))
                self.assertIsNone(resource.get("error"))
    
        def test_is_valid__other_xml(self):
            resource = {}
            with open("tests/data/correct.xml", "r") as file:
                self.assertFalse(is_valid(resource, file))
                self.assertIsNotNone(resource.get("error"))
    
        def test_is_valid__invalid_xml(self):
            resource = {}
            with open("tests/data/incorrect.xml", "r") as file:
                self.assertFalse(is_valid(resource, file))
                self.assertIsNotNone(resource.get("error"))
    
    
    
    if __name__ == "__main__":
        unittest.main()