import unittest from testing.utils import * class TestBankCardOcr(unittest.TestCase): def _helper(self, image_path, orentation): r = send_request(image_path) self.assertEqual('000', r['status'],'status case error') self.assertEqual(orentation, r['result']['orientation'], f'{image_path} orientation case error') # 后缀'_t' 为测试通过 def test_o01_t(self): image_path = '../images/error/orient_error/o01.png' self._helper(image_path, 0) def test_o02_0_t(self): image_path = '../images/error/orient_error/o02-0.png' self._helper(image_path, 0) def test_error_02_90_t(self): image_path = '../images/error/orient_error/o02-90.png' self._helper(image_path, 1) def test_error_02_180_t(self): image_path = '../images/error/orient_error/o02-180.png' self._helper(image_path, 2) def test_error_02_270_t(self): image_path = '../images/error/orient_error/o02-270.png' self._helper(image_path, 3) def test_error_03(self): image_path = '../images/error/orient_error/o03.png' self._helper(image_path, 0) def test_error_04_t(self): image_path = '../images/error/orient_error/o04.png' self._helper(image_path, 0) def test_error_05(self): image_path = '../images/error/orient_error/o05.png' self._helper(image_path, 0) def test_error_06(self): image_path = '../images/error/orient_error/o06.png' self._helper(image_path, 0) def test_error_07_t(self): image_path = '../images/error/orient_error/o07.jpg' self._helper(image_path, 0) def test_error_08_t(self): image_path = '../images/error/orient_error/o08.jpg' self._helper(image_path, 0) def test_error_09_t(self): image_path = '../images/error/orient_error/o09.jpg' self._helper(image_path, 0) def test_error_10_90_t(self): image_path = '../images/error/orient_error/o10-90.jpg' self._helper(image_path, 1) def test_error_10_180_t(self): image_path = '../images/error/orient_error/o10-180.jpg' self._helper(image_path, 2) def test_error_10_270_t(self): image_path = '../images/error/orient_error/o10-270.jpg' self._helper(image_path, 3) def test_error_11(self): image_path = '../images/error/orient_error/o11.png' self._helper(image_path, 0)