def test_readonly_writeonly_indexer(self):
        from Merlin.Testing.BaseClass import IIndexer21, IIndexer22

        def create_type(base):
            class C(base):
                def __init__(self):
                    self.f = 1

                def __setitem__(self, index, value):
                    self.f = index + value

                def __getitem__(self, index):
                    return self.f + index

            return C

        RO, WO = map(create_type, [IIndexer21, IIndexer22])

        x = RO()
        self.assertEqual(IIndexer21.__getitem__(x, 10), 11)
        self.assertRaises(AttributeError, lambda: IIndexer21.__setitem__)
        x[10] = 100
        self.assertEqual(x.f, 110)
        self.assertEqual(x[1000], 1110)

        x = WO()
        IIndexer22.__setitem__(x, 10, 100)
        self.assertEqual(x.f, 110)
    def test_readonly_writeonly_indexer(self):
        from Merlin.Testing.BaseClass import IIndexer21, IIndexer22
        def create_type(base):    
            class C(base): 
                def __init__(self): 
                    self.f = 1
                def __setitem__(self, index, value):
                    self.f = index + value 
                def __getitem__(self, index):
                    return self.f + index
            return C
        
        RO, WO = map(create_type, [IIndexer21, IIndexer22])
        
        x = RO()
        self.assertEqual(IIndexer21.__getitem__(x, 10), 11)
        self.assertRaises(AttributeError, lambda: IIndexer21.__setitem__)
        x[10] = 100
        self.assertEqual(x.f, 110)
        self.assertEqual(x[1000], 1110)

        x = WO()
        IIndexer22.__setitem__(x, 10, 100)
        self.assertEqual(x.f, 110)