Beispiel #1
0
    def test_initialization(self):
        validator = XsdValidator()
        self.assertEqual(validator.validation, 'strict')

        validator = XsdValidator(validation='lax')
        self.assertEqual(validator.validation, 'lax')
        self.assertListEqual(validator.errors, [])
Beispiel #2
0
 def test_string_representation(self):
     validator = XsdValidator()
     tmpl = '<xmlschema.validators.xsdbase.XsdValidator object at {}>'
     string_repr = str(validator)
     if platform.python_implementation() == 'PyPy':
         string_repr = re.sub(r'0x[0]+', '0x', string_repr, 1)
     self.assertEqual(string_repr, tmpl.format(hex(id(validator))))
Beispiel #3
0
 def test_copy(self):
     validator = XsdValidator(validation='lax')
     validator.parse_error(ValueError("test error"))
     self.assertEqual(len(validator.errors), 1)
     self.assertListEqual(validator.copy().errors, validator.errors)