Skip to content

Commit

Permalink
test: move those case to /tests, won't run everytime import
Browse files Browse the repository at this point in the history
  • Loading branch information
LaoshuBaby committed Feb 29, 2024
1 parent 7570c23 commit 405933c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 27 deletions.
27 changes: 0 additions & 27 deletions src/yuheng/plugin/overpass/overpass_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,30 +122,3 @@ def gen_query():
.replace("<condition_part>", gen_condition())
.replace("<output_part>", gen_output())
)


print(gen_metadata(metadata_entry_data={"out": "xml", "maxsize": 65535}))
print(gen_metadata(metadata_entry_data={"out": "popup", "maxsize": 65535}))
print(
gen_metadata(
metadata_entry_data={
"out": "json",
"timeout": 255,
"bbox": "whatever",
},
bbox_info={"E": 20, "W": 10, "S": 30, "N": 40.5},
)
)
print(
gen_metadata(
metadata_entry_data={
"out": "csv",
"timeout": 255,
},
csv_info={
"query_key_list": ["amenity", "addr:city", "admin_level"],
"explicit_declare_header": True,
"delimiter": "|",
},
)
)
53 changes: 53 additions & 0 deletions tests/cases/plugin_overpass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 每个对象访问一边完整的内容或者指定内容看是否出错

import os
import sys
import unittest

current_dir = os.path.dirname(os.path.realpath(__file__))
src_dir = os.path.join(current_dir, "../../src")
sys.path.append(src_dir)


class TestPluginOverpass(unittest.TestCase):
def setUp(self) -> None:
pass

def test_plugin_overpass(self):
from yuheng.plugin.overpass import gen_metadata

print(
gen_metadata(metadata_entry_data={"out": "xml", "maxsize": 65535})
)
print(
gen_metadata(
metadata_entry_data={"out": "popup", "maxsize": 65535}
)
)
print(
gen_metadata(
metadata_entry_data={
"out": "json",
"timeout": 255,
"bbox": "whatever",
},
bbox_info={"E": 20, "W": 10, "S": 30, "N": 40.5},
)
)
print(
gen_metadata(
metadata_entry_data={
"out": "csv",
"timeout": 255,
},
csv_info={
"query_key_list": ["amenity", "addr:city", "admin_level"],
"explicit_declare_header": True,
"delimiter": "|",
},
)
)


if __name__ == "__main__":
unittest.main()

0 comments on commit 405933c

Please sign in to comment.