orient_test.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import unittest
  2. from pathlib import Path
  3. from testing.utils import *
  4. class TestIdCardAddress(unittest.TestCase):
  5. def _helper(self, image_path, orient, image_type='0'):
  6. root = Path(__file__).parent
  7. image_path = str(root / image_path)
  8. r = send_request(image_path, image_type)
  9. self.assertEqual(orient, r['result']['orientation'], f'{image_path} orientation case error')
  10. def test_01_270(self):
  11. image_path = '../images/false/miss_orient/01_270.jpg'
  12. self._helper(image_path, 3)
  13. def test_02_270(self):
  14. image_path = '../images/false/miss_orient/02_270.jpg'
  15. self._helper(image_path, 3)
  16. def test_04(self):
  17. image_path = '../images/false/miss_orient/04.jpg'
  18. self._helper(image_path, 0, '1')
  19. def test_05(self):
  20. image_path = '../images/false/miss_orient/05.jpg'
  21. self._helper(image_path, 3)
  22. def test_06(self):
  23. image_path = '../images/false/miss_orient/06.png'
  24. self._helper(image_path, 3)
  25. def test_07(self):
  26. image_path = '../images/false/miss_orient/07.jpg'
  27. self._helper(image_path, 0, '1')
  28. def test_08(self):
  29. image_path = '../images/false/miss_orient/08.jpg'
  30. self._helper(image_path, 2, '1')
  31. if __name__ == '__main__':
  32. unittest.main()