Ejemplo n.º 1
0
    def test_copy(self):
        asset = Asset(dataset="test",
                      content_id=0,
                      asset_id=0,
                      ref_path="",
                      dis_path="",
                      asset_dict={
                          'width': 720,
                          'height': 480,
                          'quality_width': 720,
                          'quality_height': 320,
                          'yuv_type': 'yuv422p',
                          'crop_cmd': '570:320:3:2'
                      })
        new_asset = asset.copy()
        self.assertEquals(asset, new_asset)
        self.assertTrue(asset == new_asset)
        self.assertNotEquals(id(asset), id(new_asset))

        new_asset.asset_dict['yuv_type'] = 'yuv444p'
        self.assertNotEquals(asset, new_asset)

        new_asset2 = asset.copy(content_id=2)
        self.assertFalse(asset == new_asset2)
        self.assertEquals(new_asset2.content_id, 2)
        self.assertEquals(new_asset2.asset_id, 0)
Ejemplo n.º 2
0
    def test_copy(self):
        asset = Asset(dataset="test", content_id=0, asset_id=0,
                      ref_path="", dis_path="",
                      asset_dict={'width':720, 'height':480,
                                  'quality_width':720, 'quality_height':320,
                                  'yuv_type':'yuv422p',
                                  'crop_cmd':'570:320:3:2'})
        new_asset = asset.copy()
        self.assertEquals(asset, new_asset)
        self.assertTrue(asset == new_asset)
        self.assertNotEquals(id(asset), id(new_asset))

        new_asset.asset_dict['yuv_type'] = 'yuv444p'
        self.assertNotEquals(asset, new_asset)

        new_asset2 = asset.copy(content_id=2)
        self.assertFalse(asset == new_asset2)
        self.assertEquals(new_asset2.content_id, 2)
        self.assertEquals(new_asset2.asset_id, 0)
Ejemplo n.º 3
0
 def test_copy_override_asset_dict(self):
     asset = Asset(dataset="test", content_id=0, asset_id=0,
                   ref_path="", dis_path="",
                   asset_dict={'width': 720, 'height': 480,
                               'quality_width': 720, 'quality_height': 320,
                               'yuv_type': 'yuv422p',
                               'crop_cmd': '570:320:3:2'})
     new_asset = asset.copy(asset_dict={'height': 481})
     self.assertEqual(new_asset.ref_width_height, (720, 481))
     self.assertEqual(new_asset.dis_width_height, (720, 481))
     self.assertEqual(new_asset.ref_crop_cmd, '570:320:3:2')
     self.assertEqual(new_asset.dis_crop_cmd, '570:320:3:2')
Ejemplo n.º 4
0
 def test_copy_use_path_as_workpath(self):
     asset = Asset(dataset="test", content_id=0, asset_id=0,
                   ref_path="", dis_path="",
                   asset_dict={'width': 720, 'height': 480,
                               'quality_width': 720, 'quality_height': 320,
                               'yuv_type': 'yuv422p',
                               'crop_cmd': '570:320:3:2',
                               'use_path_as_workpath': True
                               })
     new_asset = asset.copy()
     self.assertNotEquals(asset, new_asset) # use_path_as_workpath gets reset
     self.assertTrue(asset.use_path_as_workpath)
     self.assertFalse(new_asset.use_path_as_workpath)
Ejemplo n.º 5
0
 def test_copy_use_path_as_workpath(self):
     asset = Asset(dataset="test", content_id=0, asset_id=0,
                   ref_path="", dis_path="",
                   asset_dict={'width': 720, 'height': 480,
                               'quality_width': 720, 'quality_height': 320,
                               'yuv_type': 'yuv422p',
                               'crop_cmd': '570:320:3:2',
                               'use_path_as_workpath': True
                               })
     new_asset = asset.copy()
     self.assertNotEquals(asset, new_asset) # use_path_as_workpath gets reset
     self.assertTrue(asset.use_path_as_workpath)
     self.assertFalse(new_asset.use_path_as_workpath)
Ejemplo n.º 6
0
 def test_copy_additional_asset_dict(self):
     asset = Asset(dataset="test", content_id=0, asset_id=0,
                   ref_path="", dis_path="",
                   asset_dict={'width': 720, 'height': 480,
                               'quality_width': 720, 'quality_height': 320,
                               'yuv_type': 'yuv422p',
                               'crop_cmd': '570:320:3:2'})
     new_asset = asset.copy(asset_dict={'start_frame': 1, 'end_frame': 10})
     self.assertEqual(new_asset.ref_start_end_frame, (1, 10))
     self.assertEqual(new_asset.dis_start_end_frame, (1, 10))
     self.assertEqual(new_asset.ref_width_height, (720, 480))
     self.assertEqual(new_asset.dis_width_height, (720, 480))
     self.assertEqual(new_asset.dis_crop_cmd, '570:320:3:2')
     self.assertEqual(new_asset.ref_crop_cmd, '570:320:3:2')