def setUp(self):
     self.factory = ff.DemoFilterFactory()
     self.pipeline3 = ppln.Pipeline(factory=self.factory,
                                    config=self.config,
                                    foo=0,
                                    bar=45)
     self.packet1 = dfb.DataPacket(height=1)
     self.packet2 = dfb.DataPacket(height=2)
 def setUp(self):
     self.factory = ff.DemoFilterFactory()
     self.packet1 = dfb.DataPacket(height=1)
     self.packet2 = dfb.DataPacket(height=2)
     self.packet3 = dfb.DataPacket(height=3)
     self.packet4 = dfb.DataPacket(height=4)
     self.packet5 = dfb.DataPacket(height=5)
     self.packet6 = dfb.DataPacket(height=9)
 def setUp(self):
     self.factory = ff.DemoFilterFactory()
     self.sink = df.Sink()
     self.file_name1 = os.path.join(data_dir5, 'short.dat')
     f1 = open(self.file_name1, 'wb')
     try:
         f1.write('one two three four five six')
     finally:
         f1.close()
     self.config = '''
 def setUp(self):
     self.factory = ff.DemoFilterFactory()
     self.file_name = os.path.join(data_dir5, 'short_tst3.dat')
     self.file_name_out = os.path.join(data_dir5, 'short_tst3.dat.bz2')
     self.file_contents = 'one two three four five six'
     f2 = open(self.file_name, 'wb')
     try:
         f2.write(self.file_contents)
     finally:
         f2.close()
 def setUp(self):
     self.factory = ff.DemoFilterFactory()
     self.pipeline1 = ppln.Pipeline(factory=self.factory,
                                    config=self.config)
     self.packet1 = dfb.DataPacket(height=1)
     self.packet2 = dfb.DataPacket(height=2)
     self.packet3 = dfb.DataPacket(height=3)
     self.packet4 = dfb.DataPacket(height=4)
     self.packet5 = dfb.DataPacket(height=5)
     self.packet6 = dfb.DataPacket(height=9)
 def setUp(self):
     self.factory = ff.DemoFilterFactory()
     self.file_name2 = os.path.join(data_dir5, 'short2.dat')
     self.file_name_out = os.path.join(data_dir5, 'short2.out')
     f2 = open(self.file_name2, 'wb')
     try:
         f2.write('one two three four five six')
     finally:
         f2.close()
     # Empty target file
     f3 = open(self.file_name_out, 'wb')
     f3.close()
    def test_filter1(self):
        import filterpype.filter_factory as ff
        factory = ff.DemoFilterFactory()

        config = '''
        [--main--]
        ftype = demo
        description = TO-DO: docstring
        
        [--route--]
        batch:3 >>>
        reverse_string >>>
        sink
        '''

        pipeline1 = ppln.Pipeline(factory=factory, config=config)
        # Manual connection for now
        pgf = pipeline1.get_filter
        pipeline1.first_filter = pgf('batch')
        ##        pgf('batch').next_filter = pgf('reverse_string')
        ##        pgf('reverse_string').next_filter = pgf('sink')

        for string in self.source_data:
            pipeline1.send(dfb.DataPacket(string))
        print '**1700** about to close'
        pipeline1.shut_down()
        for part in pgf('sink').results:
            print '**2482**  ', part.data


##        print pgf('sink'].all_data
        self.assertEquals(pgf('sink').results[-8].data, '321')
        self.assertEquals(pgf('sink').results[-7].data, '654')
        self.assertEquals(pgf('sink').results[-6].data, '496')
        self.assertEquals(pgf('sink').results[-5].data, '893')
        self.assertEquals(pgf('sink').results[-4].data, '167')
        self.assertEquals(pgf('sink').results[-3].data, '010')
        self.assertEquals(pgf('sink').results[-2].data, '987')
        self.assertEquals(pgf('sink').results[-1].data, 'X')
Exemple #8
0
 def setUp(self):
     self.factory = ff.DemoFilterFactory()
Exemple #9
0
 def setUp(self):
     self.factory = ff.DemoFilterFactory()
     self.route_parser1 = filterpype.lex_yacc4.RouteParser(debug=False)
 def test_missing_attribute2(self):
     #Batch requires size attribute
     self.assertRaises(dfb.FilterAttributeError, df.Batch)
     factory = ff.DemoFilterFactory()
     self.assertRaises(dfb.FilterAttributeError, df.Batch, factory=factory)
 def setUp(self):
     self.factory = ff.DemoFilterFactory()
     self.sink = df.Sink()
    def setUp(self):
        self.factory = ff.DemoFilterFactory()

        self.config1 = '''\