예제 #1
0
class PipeTestCase(TestCase):
    def setUp(self):
        self.p1 = Pipe()

    def test_empty(self):
        self.assertEqual(self.p1.is_empty(), True)
        self.p1.pipe_cache = [ None ]
        self.assertEqual(self.p1.is_empty(), True)

    def test_output(self):
        self.p1.pipe_cache = [1,2,3]
        self.assertEqual(self.p1.output(),1)
        self.assertEqual(self.p1.output(),2)
        self.assertEqual(self.p1.output(),3)
        self.assertEqual(self.p1.output(),None)

    def test_execute(self):
        self.assertEqual(self.p1.execute(1),1)