예제 #1
0
파일: test-patch.py 프로젝트: bgribble/mfp
    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)
예제 #2
0
파일: test-patch.py 프로젝트: wrl/mfp
    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)
예제 #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)
예제 #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)