import unittest from pathlib import Path from testing.utils import * class TestIdCardAddress(unittest.TestCase): def _helper(self, image_path, nation): root = Path(__file__).parent image_path = str(root / image_path) r = send_request(image_path, '0') self.assertEqual(nation, r['result']['ethnicity']['text'], f'{image_path} ethnicity case error') def test_01(self): image_path = '../images/false/miss_nation/01.png' self._helper(image_path, '汉') def test_03(self): image_path = '../images/false/miss_nation/03.jpg' self._helper(image_path, '汉') def test_08(self): image_path = '../images/false/miss_nation/08.jpg' self._helper(image_path, '汉') def test_09(self): image_path = '../images/false/miss_nation/09.jpg' self._helper(image_path, '汉') def test_10(self): image_path = '../images/false/miss_nation/10.jpg' self._helper(image_path, '汉') def test_11(self): image_path = '../images/false/miss_nation/11.jpg' self._helper(image_path, '回')