Beispiel #1
0
    def testRemoveSuperProperty(self):
        item = BeanItem(MyClass('bean1'))

        itemPropertyIds = item.getItemPropertyIds()
        self.assertEquals(6, len(itemPropertyIds))

        item.removeItemProperty('superPrivate')
        self.assertEquals(5, len(itemPropertyIds))
        self.assertFalse(itemPropertyIds.contains('superPrivate'))
Beispiel #2
0
    def testAddRemoveProperty(self):
        pd = MethodPropertyDescriptor('myname', MyClass,
                getattr(MyClass, 'getName'),
                getattr(MyClass, 'setName'))
        item = BeanItem(self.MyClass('bean1'))
        self.assertEquals(6, len(item.getItemPropertyIds()))
        self.assertEquals(None, item.getItemProperty('myname'))

        item.addItemProperty('myname', pd.createProperty(item.getBean()))
        self.assertEquals(7, len(item.getItemPropertyIds()))
        self.assertEquals('bean1', item.getItemProperty('myname').getValue())
        item.removeItemProperty('myname')
        self.assertEquals(6, len(item.getItemPropertyIds()))
        self.assertEquals(None, item.getItemProperty('myname'))