address_test.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import unittest
  2. from pathlib import Path
  3. from testing.utils import *
  4. class TestIdCardAddress(unittest.TestCase):
  5. def _helper(self, image_path, address):
  6. root = Path(__file__).parent
  7. image_path = str(root / image_path)
  8. r = send_request(image_path, '0')
  9. self.assertEqual(address, r['result']['address']['text'], f'{image_path} address case error')
  10. def test_01(self):
  11. image_path = '../images/false/miss_address/01.jpg'
  12. self._helper(image_path, '云南省曲靖市罗平县阿岗镇阿岗居委会阿岗村')
  13. def test_02(self):
  14. image_path = '../images/false/miss_address/02.png'
  15. self._helper(image_path, '内蒙古包头市昆都仑区昆河镇刘二圪梁村393号')
  16. def test_03(self):
  17. image_path = '../images/false/miss_address/03.jpg'
  18. self._helper(image_path, '安徽省合肥市包河区紫云路滨湖世纪城春融苑3幢1202室')
  19. def test_04(self):
  20. image_path = '../images/false/miss_address/04.png'
  21. self._helper(image_path, '呼和浩特市玉泉区泉源巷31号伊利集体户')
  22. def test_05(self):
  23. image_path = '../images/false/miss_address/05.jpg'
  24. self._helper(image_path, '西安市长安区樱花一路666号8栋1单元23层2号')
  25. def test_06_180(self):
  26. image_path = '../images/false/miss_address/06-180.jpg'
  27. self._helper(image_path, '山东省青岛市市北区港联路2号92196户')
  28. def test_06_90(self):
  29. image_path = '../images/false/miss_address/06-90.jpg'
  30. self._helper(image_path, '山东省青岛市市北区港联路2号92196户')
  31. if __name__ == '__main__':
  32. unittest.main()