Example #1
0
 def test_put_return(self) -> None:
     pm = MyMock()
     action: Put = Put("hello, world!", Return(Unit))
     action()
     self.assertEqual(pm.value, "hello, world!")
Example #2
0
 def test_put_return(self):
     pm = MyMock()
     p = Put.return_("hello, world!", IO(()))
     p(print=pm.print)
     self.assertEqual(pm.value, "hello, world!")
Example #3
0
from oslash import Put, Get, IO

main = Put(
    "What is your name?",
    Get(lambda name: Put(
        "What is your age?",
        Get(lambda age: Put("Hello " + name + "!",
                            Put("You are " + age + " years old", IO(())))))))

if __name__ == "__main__":
    main()
Example #4
0
 def test_put_return(self):
     pm = MyMock()
     p = Put("hello, world!", IO(()))
     p(print=pm.print)
     self.assertEqual(pm.value, "hello, world!")