

def testComplexAssign(self):
    d = {
        1: [0, 1, 2],
    }
    with self.Dummy('z') as d[1]:
        self.assertEqual(d, {
            1: 'z',
        })
    d = {
        1: [0, 1, 2],
    }
    with self.Dummy('z') as d[1][0]:
        self.assertEqual(d[1][0], 'z')
        self.assertEqual(d, {
            1: ['z', 1, 2],
        })
    d = {
        1: [0, 1, 2],
    }
    with self.Dummy('z') as d.values()[0][1]:
        self.assertEqual(d, {
            1: [0, 'z', 2],
        })
    d = {
        1: [0, 1, 2],
    }
    with self.Dummy(['a', 'b', 'c']) as (d[1][0], d[1][1], d[1][2]):
        self.assertEqual(d, {
            1: ['a', 'b', 'c'],
        })
    d = {
        1: [0, 1, 2],
    }
    with self.Dummy(['a', 'b', 'c']) as (d[1], d[2], d[3]):
        self.assertEqual(d, {
            1: 'a',
            2: 'b',
            3: 'c',
        })

dataset/ETHPy150Open pyjs/pyjs/examples/libtest/WithTest.py WithTest.testComplexAssign/original