#NEWLINE# def test_xmlschema_parse_default_attributes_schema_config( self ) : #NEWLINE# #INDENT# schema = self . parse ( '\n<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">\n  <xsd:element name="a" type="AType"/>\n  <xsd:complexType name="AType">\n    <xsd:sequence minOccurs="4" maxOccurs="4">\n      <xsd:element name="b" type="BType" />\n    </xsd:sequence>\n  </xsd:complexType>\n  <xsd:complexType name="BType">\n    <xsd:attribute name="hardy" type="xsd:string" default="hey" />\n  </xsd:complexType>\n</xsd:schema>\n' ) #NEWLINE# schema = etree . XMLSchema ( self , attribute_defaults = True ) #NEWLINE# parser = etree . XMLParser ( schema = schema ) #NEWLINE# tree_valid = self . parse ( '<a><b hardy="ho"/><b/><b hardy="ho"/><b/></a>' , parser = parser ) #NEWLINE# root = tree_valid . getroot ( ) #NEWLINE# self . assertEqual ( 'ho' , root [ 0 ] . get ( 'hardy' ) ) #NEWLINE# self . assertEqual ( 'hey' , root [ 1 ] . get ( 'hardy' ) ) #NEWLINE# self . assertEqual ( 'ho' , root [ 2 ] . get ( 'hardy' ) ) #NEWLINE# self . assertEqual ( 'hey' , root [ 3 ] . get ( 'hardy' ) )