nation_test.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import unittest
  2. from pathlib import Path
  3. from testing.utils import *
  4. class TestIdCardAddress(unittest.TestCase):
  5. def _helper(self, image_path, nation):
  6. root = Path(__file__).parent
  7. image_path = str(root / image_path)
  8. r = send_request(image_path, '0')
  9. self.assertEqual(nation, r['result']['ethnicity']['text'], f'{image_path} ethnicity case error')
  10. def test_01(self):
  11. image_path = '../images/false/miss_nation/01.png'
  12. self._helper(image_path, '汉')
  13. def test_03(self):
  14. image_path = '../images/false/miss_nation/03.jpg'
  15. self._helper(image_path, '汉')
  16. def test_08(self):
  17. image_path = '../images/false/miss_nation/08.jpg'
  18. self._helper(image_path, '汉')
  19. def test_09(self):
  20. image_path = '../images/false/miss_nation/09.jpg'
  21. self._helper(image_path, '汉')
  22. def test_10(self):
  23. image_path = '../images/false/miss_nation/10.jpg'
  24. self._helper(image_path, '汉')
  25. def test_11(self):
  26. image_path = '../images/false/miss_nation/11.jpg'
  27. self._helper(image_path, '回')