def testRemoveContainerProperty(self): container = BeanContainer(Person) container.setBeanIdResolver(self.PersonNameResolver()) container.addBean(Person('John')) self.assertEquals('John', container.getContainerProperty('John', 'name').getValue()) self.assertTrue(container.removeContainerProperty('name')) self.assertEquals(container.getContainerProperty('John', 'name'), None) self.assertNotEquals(container.getItem('John'), None) # property removed also from item self.assertEquals(container.getItem('John').getItemProperty('name'), None)
def testAddNestedContainerProperty(self): container = BeanContainer(NestedMethodPropertyTest.Person) container.setBeanIdProperty('name') container.addBean(NestedMethodPropertyTest.Person('John', NestedMethodPropertyTest.Address('Ruukinkatu 2-4', 20540))) self.assertTrue(container.addNestedContainerProperty('address.street')) self.assertEquals('Ruukinkatu 2-4', container.getContainerProperty('John', 'address.street').getValue())