orientation_test.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import unittest
  2. from testing.utils import *
  3. class TestBankCardOcr(unittest.TestCase):
  4. def _helper(self, image_path, orentation):
  5. r = send_request(image_path)
  6. self.assertEqual('000', r['status'],'status case error')
  7. self.assertEqual(orentation, r['result']['orientation'], f'{image_path} orientation case error')
  8. # 后缀'_t' 为测试通过
  9. def test_o01_t(self):
  10. image_path = '../images/error/orient_error/o01.png'
  11. self._helper(image_path, 0)
  12. def test_o02_0_t(self):
  13. image_path = '../images/error/orient_error/o02-0.png'
  14. self._helper(image_path, 0)
  15. def test_error_02_90_t(self):
  16. image_path = '../images/error/orient_error/o02-90.png'
  17. self._helper(image_path, 1)
  18. def test_error_02_180_t(self):
  19. image_path = '../images/error/orient_error/o02-180.png'
  20. self._helper(image_path, 2)
  21. def test_error_02_270_t(self):
  22. image_path = '../images/error/orient_error/o02-270.png'
  23. self._helper(image_path, 3)
  24. def test_error_03(self):
  25. image_path = '../images/error/orient_error/o03.png'
  26. self._helper(image_path, 0)
  27. def test_error_04_t(self):
  28. image_path = '../images/error/orient_error/o04.png'
  29. self._helper(image_path, 0)
  30. def test_error_05(self):
  31. image_path = '../images/error/orient_error/o05.png'
  32. self._helper(image_path, 0)
  33. def test_error_06(self):
  34. image_path = '../images/error/orient_error/o06.png'
  35. self._helper(image_path, 0)
  36. def test_error_07_t(self):
  37. image_path = '../images/error/orient_error/o07.jpg'
  38. self._helper(image_path, 0)
  39. def test_error_08_t(self):
  40. image_path = '../images/error/orient_error/o08.jpg'
  41. self._helper(image_path, 0)
  42. def test_error_09_t(self):
  43. image_path = '../images/error/orient_error/o09.jpg'
  44. self._helper(image_path, 0)
  45. def test_error_10_90_t(self):
  46. image_path = '../images/error/orient_error/o10-90.jpg'
  47. self._helper(image_path, 1)
  48. def test_error_10_180_t(self):
  49. image_path = '../images/error/orient_error/o10-180.jpg'
  50. self._helper(image_path, 2)
  51. def test_error_10_270_t(self):
  52. image_path = '../images/error/orient_error/o10-270.jpg'
  53. self._helper(image_path, 3)
  54. def test_error_11(self):
  55. image_path = '../images/error/orient_error/o11.png'
  56. self._helper(image_path, 0)