def test_memoization(self): f = Foobar() memoized = f.memoize(f.expensive()) self.assertNodeOutput("$put(v0,$expensive())", memoized) self.assertNodeOutput("$put(v0,$expensive())", memoized) self.assertNodeOutput("$moo($put(v0,$expensive()),$get(v0))", f.moo(memoized, memoized))
def test_memoization(self): f = Foobar() memoized = f.memoize(f.expensive()) self.assertNodeOutput("$put(v0,$expensive())", memoized) self.assertNodeOutput("$put(v0,$expensive())", memoized) self.assertNodeOutput("$moo($put(v0,$expensive()),$get(v0))", f.moo(memoized, memoized))
def test_multi_arg(self): f = Foobar() self.assertNodeOutput("$moo('awesome',3,4)", f.moo('awesome', 3, 4))
def test_multi_arg(self): f = Foobar() self.assertNodeOutput("$moo('awesome',3,4)", f.moo('awesome', 3, 4))