def testListAndDictOps(self):
        testme = AllTests()

        # List/dict operations

        class Empty: pass

        try:
            1 in Empty()
            self.fail('failed, should have raised TypeError')
        except TypeError:
            pass

        callLst[:] = []
        1 in testme
        self.assertCallStack([('__contains__', (testme, 1))])

        callLst[:] = []
        testme[1]
        self.assertCallStack([('__getitem__', (testme, 1))])

        callLst[:] = []
        testme[1] = 1
        self.assertCallStack([('__setitem__', (testme, 1, 1))])

        callLst[:] = []
        del testme[1]
        self.assertCallStack([('__delitem__', (testme, 1))])

        callLst[:] = []
        testme[:42]
        self.assertCallStack([('__getslice__', (testme, 0, 42))])

        callLst[:] = []
        testme[:42] = "The Answer"
        self.assertCallStack([('__setslice__', (testme, 0, 42, "The Answer"))])

        callLst[:] = []
        del testme[:42]
        self.assertCallStack([('__delslice__', (testme, 0, 42))])

        callLst[:] = []
        testme[2:1024:10]
        self.assertCallStack([('__getitem__', (testme, slice(2, 1024, 10)))])

        callLst[:] = []
        testme[2:1024:10] = "A lot"
        self.assertCallStack([('__setitem__', (testme, slice(2, 1024, 10),
                                                                    "A lot"))])
        callLst[:] = []
        del testme[2:1024:10]
        self.assertCallStack([('__delitem__', (testme, slice(2, 1024, 10)))])

        callLst[:] = []
        testme[:42, ..., :24:, 24, 100]
        self.assertCallStack([('__getitem__', (testme, (slice(None, 42, None),
                                                        Ellipsis,
                                                        slice(None, 24, None),
                                                        24, 100)))])
        callLst[:] = []
        testme[:42, ..., :24:, 24, 100] = "Strange"
        self.assertCallStack([('__setitem__', (testme, (slice(None, 42, None),
                                                        Ellipsis,
                                                        slice(None, 24, None),
                                                        24, 100), "Strange"))])
        callLst[:] = []
        del testme[:42, ..., :24:, 24, 100]
        self.assertCallStack([('__delitem__', (testme, (slice(None, 42, None),
                                                        Ellipsis,
                                                        slice(None, 24, None),
                                                        24, 100)))])

        # Now remove the slice hooks to see if converting normal slices to
        #  slice object works.

        getslice = AllTests.__getslice__
        del AllTests.__getslice__
        setslice = AllTests.__setslice__
        del AllTests.__setslice__
        delslice = AllTests.__delslice__
        del AllTests.__delslice__

        # XXX when using new-style classes the slice testme[:42] produces
        #  slice(None, 42, None) instead of slice(0, 42, None). py3k will have
        #  to change this test. Jython already shows the py3k behavior by
        #  default.
        callLst[:] = []
        testme[:42]
        if test_support.is_jython:
            self.assertCallStack([('__getitem__', (testme,
                                                   slice(None, 42, None)))])
        else:
            self.assertCallStack([('__getitem__', (testme,
                                                   slice(0, 42, None)))])

        callLst[:] = []
        testme[:42] = "The Answer"
        if test_support.is_jython:
            self.assertCallStack([('__setitem__',(testme,
                                                  slice(None, 42, None),
                                                  "The Answer"))])
        else:
            self.assertCallStack([('__setitem__', (testme,
                                                   slice(0, 42, None),
                                                   "The Answer"))])
        callLst[:] = []
        del testme[:42]
        if test_support.is_jython:
            self.assertCallStack([('__delitem__', (testme,
                                                   slice(None, 42, None)))])
        else:
            self.assertCallStack([('__delitem__', (testme,
                                                   slice(0, 42, None)))])

        # Restore the slice methods, or the tests will fail with regrtest -R.
        AllTests.__getslice__ = getslice
        AllTests.__setslice__ = setslice
        AllTests.__delslice__ = delslice
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_class.py/ClassTests.testListAndDictOps/original