import unittest from formats.xml_format import is_valid class TestXmlFormat(unittest.TestCase): def test_is_valid__valid(self): resource = {} with open("tests/data/correct.xml", "r") as file: self.assertTrue(is_valid(resource, file)) self.assertIsNone(resource.get("error")) def test_is_valid__invalid(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()