Example #1
0
 def test_dogma_set_nonexistent(self):
     
     beliefs = {'book_title':'/bookstore/book[1]/title',
     'childrens_title':"""/bookstore/book[@category = 'CHILDREN']/title""",
     'foobar':'''/bookstore/foobar'''}
     
     dataObject = etree.parse(StringIO(BOOKS))  
     d = XmlDogma('Books',beliefs,dataObject)
     
     with assert_raises_regexp(AttributeError,"""Blasphemy! You can't create the new beliefs"""):
         d.not_a_belief = 5
     
     with assert_raises_regexp(DogmaGetterSetterException,"""Error setting the 'foobar' property of the class 'BooksXmlDogma'"""):
         d.foobar = 5
Example #2
0
 def dont_txxt_dogma_set_nonexistent(self):
     
     beliefs = {'book_title':'/bookstore/book[1]/title',
     'childrens_title':"""/bookstore/book[@category = 'CHILDREN']/title""",
     'foobar':'''/bookstore/foobar'''}
     
     dataObject = etree.parse(StringIO(BOOKS))  
     d = XmlDogma('Books',beliefs,dataObject)
     
     with assert_raises_regexp(AttributeError,"""Blasphemy! You can't create the new beliefs"""):
         d.not_a_belief = 5
     
     with assert_raises_regexp(DogmaGetterSetterException,"""Error setting the 'foobar' property of the class 'BooksXmlDogma'"""):
         d.foobar = 5