MCPcopy Create free account
hub / github.com/sissaschool/xmlschema / test_missing_child

Method test_missing_child

tests/test_dataobjects.py:431–445  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

429 self.assertTrue(col_data.is_valid())
430
431 def test_missing_child(self):
432 col_data = self.col_schema.decode(self.col_xml_filename)
433 self.assertTrue(col_data.is_valid())
434
435 title = col_data[0].pop(1)
436 with self.assertRaises(XMLSchemaValidationError) as ec:
437 col_data.validate()
438 self.assertIn("Unexpected child with tag 'year' at position 2", str(ec.exception))
439 self.assertFalse(col_data.is_valid())
440 errors = list(col_data.iter_errors())
441 self.assertEqual(len(errors), 1)
442 self.assertIn("Unexpected child with tag 'year' at position 2", str(errors[0]))
443
444 col_data[0].insert(1, title)
445 self.assertTrue(col_data.is_valid())
446
447 def test_max_depth_validation(self):
448 col_data = self.col_schema.decode(self.col_xml_filename)

Callers

nothing calls this directly

Calls 5

decodeMethod · 0.45
is_validMethod · 0.45
validateMethod · 0.45
iter_errorsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected