def test_check_picture(self, mock_call_MediaInfo): # No modification -> should return normally D_image = {"Image": {"Width": "320", "Height": "240"}} mock_call_MediaInfo.return_value = D_image self.assertEqual(check_picture(None), D_image) # Missing keys -> should fail for D_image in ({}, {"Image": {"Width": "320"}}, {"Image": {"Height": "320"}}): mock_call_MediaInfo.return_value = D_image with self.assertRaises(MediaInfoError): check_picture(None)
def test_check_picture(self, mock_call_MediaInfo): # No modification -> should return normally D_image = {"Image": {"Width": "320", "Height": "240"}} mock_call_MediaInfo.return_value = D_image self.assertEqual(check_picture(None), D_image) # Missing keys -> should fail for D_image in ( {}, {"Image": {"Width": "320"}}, {"Image": {"Height": "320"}} ): mock_call_MediaInfo.return_value = D_image with self.assertRaises(MediaInfoError): check_picture(None)
def _scan_image(self, ae_type, ae_path): img_info = check_picture(ae_path, self.vod_config.mediainfo_path) img_width = img_info["Image"]["Width"] img_height = img_info["Image"]["Height"] self.D_app[ae_type]["Image_Aspect_Ratio"] = "{}x{}".format( img_width, img_height ) self.D_app[ae_type]["Custom_Image_Aspect_Ratio"] = "{}x{}".format( 63, 43 )
def _scan_image(self, ae_type, ae_path): img_info = check_picture(ae_path, self.vod_config.mediainfo_path) img_width = img_info["Image"]["Width"] img_height = img_info["Image"]["Height"] self.D_app[ae_type]["Image_Aspect_Ratio"] = "{}x{}".format( img_width, img_height)