Skip to content

Commit

Permalink
refactor: split testcase to independent file
Browse files Browse the repository at this point in the history
  • Loading branch information
LaoshuBaby committed Feb 29, 2024
1 parent 303c611 commit 8e1f11a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/yuheng/plugin/driver_geojson/__main__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import argparse
import os
import sys
from typing import Union

from pprint import pprint
import geojson

current_dir = os.path.dirname(os.path.realpath(__file__))
src_dir = os.path.join(current_dir, "..", "..", "..")
sys.path.append(src_dir)
from pprint import pprint


from yuheng import Carto

Expand Down Expand Up @@ -78,19 +79,4 @@ def write(


if __name__ == "__main__":
ans = read(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
"..",
"tests",
"assets",
"geojson",
"geojsonio-ring2.geojson",
# "geojsonio-commute-bus.geojson",
),
output_target="yuheng",
)
pprint(ans)
main()
35 changes: 35 additions & 0 deletions tests/cases/plugin_driver_geojson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 每个对象访问一边完整的内容或者指定内容看是否出错

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 TestPluginDriverPoly(unittest.TestCase):
def setUp(self) -> None:
pass

def test_plugin_driver_geojson_import(self):
from yuheng.plugin.driver_geojson.__main__ import read
from pprint import pprint

ans = read(
os.path.join(
os.path.dirname(__file__),
"..",
"assets",
"geojson",
"geojsonio-ring2.geojson",
# "geojsonio-commute-bus.geojson",
),
output_target="yuheng",
)
pprint(ans)


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

0 comments on commit 8e1f11a

Please sign in to comment.