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

Method check_decode

tests/validation/test_decoding.py:558–569  ·  view source on GitHub ↗
(self, xsd_component, data, expected, **kwargs)

Source from the content-addressed store, hash-verified

556 cases_dir = pathlib.Path(__file__).parent.joinpath('../test_cases')
557
558 def check_decode(self, xsd_component, data, expected, **kwargs):
559 if isinstance(expected, type) and issubclass(expected, Exception):
560 self.assertRaises(expected, xsd_component.decode, data, **kwargs)
561 else:
562 obj = xsd_component.decode(data, **kwargs)
563 if isinstance(obj, tuple) and len(obj) == 2 and isinstance(obj[1], list) \
564 and isinstance(obj[1][0], Exception):
565 self.assertEqual(expected, obj[0])
566 self.assertTrue(isinstance(obj[0], type(expected)))
567 else:
568 self.assertEqual(expected, obj)
569 self.assertTrue(isinstance(obj, type(expected)))
570
571 @unittest.skipIf(lxml_etree is None, "The lxml library is not available.")
572 def test_lxml(self):

Callers 5

test_string_facetsMethod · 0.95
test_hex_binary_typeMethod · 0.95
test_decimal_typeMethod · 0.95

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected