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