

def test_instance_caching_binops(self):
    f = SomeFactor()
    g = SomeOtherFactor()
    for (lhs, rhs) in product([f, g], [f, g]):
        self.assertIs((lhs + rhs), (lhs + rhs))
        self.assertIs((lhs - rhs), (lhs - rhs))
        self.assertIs((lhs * rhs), (lhs * rhs))
        self.assertIs((lhs / rhs), (lhs / rhs))
        self.assertIs((lhs ** rhs), (lhs ** rhs))
    self.assertIs((1 + rhs), (1 + rhs))
    self.assertIs((rhs + 1), (rhs + 1))
    self.assertIs((1 - rhs), (1 - rhs))
    self.assertIs((rhs - 1), (rhs - 1))
    self.assertIs((2 * rhs), (2 * self))
    self.assertIs((rhs * 2), (rhs * 2))
    self.assertIs((2 / rhs), (2 / rhs))
    self.assertIs((rhs / 2), (rhs / 2))
    self.assertIs((2 ** rhs), (2 ** rhs))
    self.assertIs((rhs ** 2), (rhs ** 2))
    self.assertIs(((f + g) + (f + g)), ((f + g) + (f + g)))

dataset/ETHPy150Open quantopian/zipline/tests/pipeline/test_term.py ObjectIdentityTestCase.test_instance_caching_binops/VarMisuse@213/233 `rhs`->`self`