Ejemplo n.º 1
0
    def test_loadsave(self):
        o1 = mkproc(self, "message", "'hello, world'")
        o2 = mkproc(self, "print")
        o1.connect(0, o2, 0)

        json_1 = self.patch.json_serialize()
        self.patch.delete()

        MFPApp().next_obj_id = 0 
        p2 = Patch('default', '', None, NaiveScope(), 'default')
        p2.json_deserialize(json_1)

        json_2 = p2.json_serialize()

        dict_1 = json.loads(json_1)
        dict_2 = json.loads(json_2)

        for k in ['export_x', 'export_y', 'export_w', 'export_h', 
                  'height', 'width']:
            if k in dict_2['gui_params']:
                del dict_2['gui_params'][k]

        fail = False 

        for elt in [ 'gui_params', 'objects', 'type', 'scopes' ]:
            if dict_1.get(elt) != dict_2.get(elt):
                print("=======", elt, "========")
                print(dict_1.get(elt))
                print("=====================")
                print(dict_2.get(elt))
                fail = True 

        self.assertEqual(fail, False)
Ejemplo n.º 2
0
    def test_loadsave(self):
        o1 = mkproc(self, "message", "'hello, world'")
        o2 = mkproc(self, "print")
        o1.connect(0, o2, 0)
        json_1 = self.patch.json_serialize()
        self.patch.delete()

        MFPApp().next_obj_id = 0
        p2 = Patch('default', '', None, None, 'default')
        p2.json_deserialize(json_1)

        json_2 = p2.json_serialize()

        dict_1 = json.loads(json_1)
        dict_2 = json.loads(json_2)
        fail = False

        for elt in ['gui_params', 'objects', 'type', 'scopes']:
            if dict_1.get(elt) != dict_2.get(elt):
                print "=======", elt, "========"
                print dict_1.get(elt)
                print "====================="
                print dict_2.get(elt)
                fail = True

        self.assertEqual(fail, False)
Ejemplo n.º 3
0
    def test_loadsave(self):
        o1 = mkproc(self, "message", "'hello, world'")
        o2 = mkproc(self, "print")
        o1.connect(0, o2, 0)
        json_1 = self.patch.json_serialize()
        self.patch.delete()

        MFPApp().next_obj_id = 0 
        p2 = Patch('default', '', None, None, 'default')
        p2.json_deserialize(json_1)

        json_2 = p2.json_serialize()

        dict_1 = json.loads(json_1)
        dict_2 = json.loads(json_2)
        fail = False 

        for elt in [ 'gui_params', 'objects', 'type', 'scopes' ]:
            if dict_1.get(elt) != dict_2.get(elt):
                print "=======", elt, "========"
                print dict_1.get(elt)
                print "====================="
                print dict_2.get(elt)
                fail = True 

        self.assertEqual(fail, False)
Ejemplo n.º 4
0
    def test_loadsave(self):
        o1 = mkproc(self, "message", "'hello, world'")
        o2 = mkproc(self, "print")
        o1.connect(0, o2, 0)

        json_1 = self.patch.json_serialize()
        self.patch.delete()

        MFPApp().next_obj_id = 0
        p2 = Patch('default', '', None, NaiveScope(), 'default')
        p2.json_deserialize(json_1)

        json_2 = p2.json_serialize()

        dict_1 = json.loads(json_1)
        dict_2 = json.loads(json_2)

        for k in [
                'export_x', 'export_y', 'export_w', 'export_h', 'height',
                'width'
        ]:
            if k in dict_2['gui_params']:
                del dict_2['gui_params'][k]

        fail = False

        for elt in ['gui_params', 'objects', 'type', 'scopes']:
            if dict_1.get(elt) != dict_2.get(elt):
                print("=======", elt, "========")
                print(dict_1.get(elt))
                print("=====================")
                print(dict_2.get(elt))
                fail = True

        self.assertEqual(fail, False)
Ejemplo n.º 5
0
 def setUp(self):
     self.patch = Patch('default', '', None, NaiveScope(), 'default')
     self.plus = mkproc(
         self,
         "+",
         None,
     )
     self.out = mkproc(self, "var")
     self.plus.connect(0, self.out, 0)
Ejemplo n.º 6
0
 def setUp(self):
     self.patch = Patch('default', '', None, None, 'default')
     FanOut.trail = []
     self.procs = [FanOut(self.patch, i) for i in range(0, 10)]
     for i in range(1, 5):
         self.procs[0].connect(i - 1, self.procs[i], 0)
     for i in range(5, 9):
         self.procs[1].connect(i - 5, self.procs[i], 0)
     self.procs[3].connect(0, self.procs[9], 0)
Ejemplo n.º 7
0
class PatchTests(TestCase):
    def setUp(self):
        MFPApp().no_gui = True
        MFPApp().next_obj_id = 0
        MFPApp().objects = {}
        self.patch = Patch('default', '', None, NaiveScope(), 'default')
        pass

    def test_loadsave(self):
        o1 = mkproc(self, "message", "'hello, world'")
        o2 = mkproc(self, "print")
        o1.connect(0, o2, 0)

        json_1 = self.patch.json_serialize()
        self.patch.delete()

        MFPApp().next_obj_id = 0
        p2 = Patch('default', '', None, NaiveScope(), 'default')
        p2.json_deserialize(json_1)

        json_2 = p2.json_serialize()

        dict_1 = json.loads(json_1)
        dict_2 = json.loads(json_2)

        for k in [
                'export_x', 'export_y', 'export_w', 'export_h', 'height',
                'width'
        ]:
            if k in dict_2['gui_params']:
                del dict_2['gui_params'][k]

        fail = False

        for elt in ['gui_params', 'objects', 'type', 'scopes']:
            if dict_1.get(elt) != dict_2.get(elt):
                print("=======", elt, "========")
                print(dict_1.get(elt))
                print("=====================")
                print(dict_2.get(elt))
                fail = True

        self.assertEqual(fail, False)

    def test_inlet_outlet(self):
        o1 = mkproc(self, "inlet")
        o2 = mkproc(self, "outlet")
        o1.connect(0, o2, 0)

        p2 = Patch('default', '', None, NaiveScope(), 'default')
        o3 = MFPApp().create("inlet", None, p2, None, "inlet")
        o4 = MFPApp().create("outlet", None, p2, None, "outlet")
        o3.connect(0, o4, 0)

        self.patch.connect(0, p2, 0)
        self.patch.send(True)

        self.assertEqual(p2.outlets[0], True)
Ejemplo n.º 8
0
class PatchTests (TestCase):
    def setUp(self):
        MFPApp().no_gui = True
        MFPApp().next_obj_id = 0
        MFPApp().objects = {}
        self.patch = Patch('default', '', None, NaiveScope(), 'default')
        pass

    def test_loadsave(self):
        o1 = mkproc(self, "message", "'hello, world'")
        o2 = mkproc(self, "print")
        o1.connect(0, o2, 0)

        json_1 = self.patch.json_serialize()
        self.patch.delete()

        MFPApp().next_obj_id = 0 
        p2 = Patch('default', '', None, NaiveScope(), 'default')
        p2.json_deserialize(json_1)

        json_2 = p2.json_serialize()

        dict_1 = json.loads(json_1)
        dict_2 = json.loads(json_2)

        for k in ['export_x', 'export_y', 'export_w', 'export_h', 
                  'height', 'width']:
            if k in dict_2['gui_params']:
                del dict_2['gui_params'][k]

        fail = False 

        for elt in [ 'gui_params', 'objects', 'type', 'scopes' ]:
            if dict_1.get(elt) != dict_2.get(elt):
                print("=======", elt, "========")
                print(dict_1.get(elt))
                print("=====================")
                print(dict_2.get(elt))
                fail = True 

        self.assertEqual(fail, False)

    def test_inlet_outlet (self):
        o1 = mkproc(self, "inlet")
        o2 = mkproc(self, "outlet")
        o1.connect(0, o2, 0)
        
        p2 = Patch('default', '', None, NaiveScope(), 'default')
        o3 = MFPApp().create("inlet", None, p2, None, "inlet")
        o4 = MFPApp().create("outlet", None, p2, None, "outlet")
        o3.connect(0, o4, 0)

        self.patch.connect(0, p2, 0)
        self.patch.send(True)

        self.assertEqual(p2.outlets[0], True)
Ejemplo n.º 9
0
    def test_inlet_outlet(self):
        o1 = mkproc(self, "inlet")
        o2 = mkproc(self, "outlet")
        o1.connect(0, o2, 0)

        p2 = Patch('default', '', None, None, 'default')
        o3 = MFPApp().create("inlet", None, p2, None, "inlet")
        o4 = MFPApp().create("outlet", None, p2, None, "outlet")
        o3.connect(0, o4, 0)

        self.patch.connect(0, p2, 0)
        self.patch.send(True)

        self.assertEqual(p2.outlets[0], True)
Ejemplo n.º 10
0
 def setUp(self):
     self.patch = Patch('default', '', None, None, 'default')
     self.var = mkproc(self, "var", "0")
     self.inc = LimitedIncr(self.patch)
     self.var.connect(0, self.inc, 0)
     self.inc.connect(0, self.var, 0)
Ejemplo n.º 11
0
 def __init__(self, patch, tag):
     self.patch = Patch('default', '', None, None, 'default')
     self.tag = tag
     Processor.__init__(self, 1, 4, "fanout", '', patch, None, None)
Ejemplo n.º 12
0
 def setUp(self):
     self.patch = Patch('default', '', None, NaiveScope(), 'default')
     self.r = mkproc(self, "route", 'False, 1, "hello"')
Ejemplo n.º 13
0
 def setUp(self):
     self.patch = Patch('default', '', None, NaiveScope(), 'default')
     self.pr = mkproc(self, "print")
     self.out = mkproc(self, "var")
     self.pr.connect(0, self.out, 0)
Ejemplo n.º 14
0
 def setUp(self):
     MFPApp().no_gui = True
     MFPApp().next_obj_id = 0
     MFPApp().objects = {}
     self.patch = Patch('default', '', None, None, 'default')
     pass
Ejemplo n.º 15
0
 def setUp(self):
     MFPApp().no_gui = True
     MFPApp().next_obj_id = 0
     MFPApp().objects = {}
     self.patch = Patch('default', '', None, NaiveScope(), 'default')
     pass
Ejemplo n.º 16
0
 def setUp(self):
     self.patch = Patch('default', '', None, None, 'default')
Ejemplo n.º 17
0
 def setUp(self):
     self.patch = Patch('default', '', None, NaiveScope(), 'default')