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_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)
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)
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 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)
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)
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)
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)
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)
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)
def __init__(self, patch, tag): self.patch = Patch('default', '', None, None, 'default') self.tag = tag Processor.__init__(self, 1, 4, "fanout", '', patch, None, None)
def setUp(self): self.patch = Patch('default', '', None, NaiveScope(), 'default') self.r = mkproc(self, "route", 'False, 1, "hello"')
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)
def setUp(self): MFPApp().no_gui = True MFPApp().next_obj_id = 0 MFPApp().objects = {} self.patch = Patch('default', '', None, None, 'default') pass
def setUp(self): MFPApp().no_gui = True MFPApp().next_obj_id = 0 MFPApp().objects = {} self.patch = Patch('default', '', None, NaiveScope(), 'default') pass
def setUp(self): self.patch = Patch('default', '', None, None, 'default')
def setUp(self): self.patch = Patch('default', '', None, NaiveScope(), 'default')