def test_check_getitemexpression(self): m = self.m t = IndexTemplate(m.t) e = m.dv[t] == m.v[t] temp = _check_getitemexpression(e, 0) self.assertIs(e._args[0], temp[0]) self.assertIs(e._args[1], temp[1]) self.assertIs(m.dv, temp[0]._base) self.assertIs(m.v, temp[1]._base) temp = _check_getitemexpression(e, 1) self.assertIsNone(temp) e = m.v[t] == m.dv[t] temp = _check_getitemexpression(e, 1) self.assertIs(e._args[0], temp[1]) self.assertIs(e._args[1], temp[0]) self.assertIs(m.dv, temp[0]._base) self.assertIs(m.v, temp[1]._base) temp = _check_getitemexpression(e, 0) self.assertIsNone(temp) e = m.v[t] == m.v[t] temp = _check_getitemexpression(e, 0) self.assertIsNone(temp) temp = _check_getitemexpression(e, 1) self.assertIsNone(temp)
def test_check_getitemexpression(self): m = self.m t = IndexTemplate(m.t) e = m.dv[t] == m.v[t] temp = _check_getitemexpression(e, 0) self.assertIs(e.arg(0), temp[0]) self.assertIs(e.arg(1), temp[1]) self.assertIs(m.dv, temp[0]._base) self.assertIs(m.v, temp[1]._base) temp = _check_getitemexpression(e, 1) self.assertIsNone(temp) e = m.v[t] == m.dv[t] temp = _check_getitemexpression(e, 1) self.assertIs(e.arg(0), temp[1]) self.assertIs(e.arg(1), temp[0]) self.assertIs(m.dv, temp[0]._base) self.assertIs(m.v, temp[1]._base) temp = _check_getitemexpression(e, 0) self.assertIsNone(temp) e = m.v[t] == m.v[t] temp = _check_getitemexpression(e, 0) self.assertIsNone(temp) temp = _check_getitemexpression(e, 1) self.assertIsNone(temp)