#NEWLINE# def test_default_attribute_values( ) : #NEWLINE# #INDENT# '\n    Test default values for unsupplied base type\n    attributes.\n    ' #NEWLINE# grammar = "\n    First:\n        'first' seconds+=Second\n        ('A' a=INT)?\n        ('B' b=BOOL)?\n        ('C' c=STRING)?\n        ('D' d=FLOAT)?\n        ('E' e+=INT)?\n        ('F' f*=INT)?\n        ('G' g?=INT)?\n    ;\n\n    Second:\n        INT|STRING\n    ;\n    " #NEWLINE# metamodel = metamodel_from_str ( grammar ) #NEWLINE# model = metamodel . model_from_str ( '\n            first 45 "foo" 78\n    ' ) #NEWLINE# assert ( type ( model ) . __name__ == 'First' ) #NEWLINE# assert ( type ( model . seconds ) is list ) #NEWLINE# assert ( type ( model . a ) is int ) #NEWLINE# assert ( model . a == 0 ) #NEWLINE# assert ( type ( model . b ) is bool ) #NEWLINE# assert ( model . b is False ) #NEWLINE# assert ( type ( model . c ) is text ) #NEWLINE# assert ( model . c == '' ) #NEWLINE# assert ( type ( model . d ) is float ) #NEWLINE# assert ( model . d == 0.0 ) #NEWLINE# assert ( type ( model . e ) is list ) #NEWLINE# assert ( model . e == [ ] ) #NEWLINE# assert ( type ( model . f ) is list ) #NEWLINE# assert ( model . f == [ ] ) #NEWLINE# assert ( type ( model . g ) is bool ) #NEWLINE# assert ( model . g is False )