提交 a7d39b66 编写于 作者: D DQYuan

pass unit test

上级 904b1ba3
......@@ -79,14 +79,14 @@ def test_fill_province(monkeypatch):
def test_fill_city_1():
pca = Pca('', '', '朝阳区')
cpca._fill_city(pca, {'朝阳区': '北京市'})
cpca._fill_city(pca, {'朝阳区': '北京市'}, True)
assert pca.city == '北京市'
def test_fill_city_2(monkeypatch):
pca = Pca('', '', '朝阳区')
mo_map = mock_map(monkeypatch, 'area_map', '北京市')
cpca._fill_city(pca, {})
cpca._fill_city(pca, {}, True)
mo_map.get_value.assert_called_once_with(pca.area, C)
assert pca.city == '北京市'
......@@ -96,7 +96,7 @@ def test_fill_city_3(monkeypatch):
pca = Pca('江苏省', '', '鼓楼区')
mock_map(monkeypatch, 'area_map', '', is_contain=True, is_unique_value=False)
mo_map = mock_map(monkeypatch, 'province_area_map', '南京市')
cpca._fill_city(pca, {})
cpca._fill_city(pca, {}, True)
mo_map.get_value.assert_called_once_with(('江苏省','鼓楼区'), C)
assert pca.city == '南京市'
......@@ -255,7 +255,7 @@ def test_handle_one_record1(monkeypatch):
monkeypatch.setattr(cpca, 'city_map', _dict2addr_map({'淮安': '淮安市', '淮安市': '淮安市'}, {'淮安市':'江苏省'}))
monkeypatch.setattr(cpca, 'area_map', _dict2addr_map({'清浦区': '清浦区'}, {'清浦区': '淮安市'}))
result1 = cpca._handle_one_record("清浦区人民路111号", {}, True, 0, True)
result1 = cpca._handle_one_record("清浦区人民路111号", {}, True, 0, True, True)
assert result1["省"] == '江苏省'
assert result1['市'] == '淮安市'
......@@ -272,7 +272,7 @@ def test_handle_one_record2(monkeypatch):
monkeypatch.setattr(cpca, 'city_map', _dict2addr_map({'淮安': '淮安市', '淮安市': '淮安市'}, {'淮安市':'江苏省'}))
monkeypatch.setattr(cpca, 'area_map', _dict2addr_map({'清浦区': '清浦区'}, {'清浦区': '淮安市'}))
result1 = cpca._handle_one_record("清浦区人民路111号", {}, False, 5, True)
result1 = cpca._handle_one_record("清浦区人民路111号", {}, False, 5, True, True)
assert result1["省"] == '江苏省'
assert result1['市'] == '淮安市'
......@@ -290,7 +290,7 @@ def test_handle_one_record3(monkeypatch):
monkeypatch.setattr(cpca, 'area_map', _dict2addr_map({'清浦区': '清浦区'}, is_unique_value=False))
monkeypatch.setattr(cpca, 'province_area_map', _dict2addr_map({('江苏省', '清浦区'):''}, {('江苏省', '清浦区'):'淮安市'}))
result1 = cpca._handle_one_record("江苏省清浦区人民路111号", {}, False, 5, True)
result1 = cpca._handle_one_record("江苏省清浦区人民路111号", {}, False, 5, True, True)
assert result1["省"] == '江苏省'
assert result1['市'] == '淮安市'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册