Skip to content

Commit 19dbd66

Browse files
committed
Add test to load test data
1 parent 177ab1c commit 19dbd66

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pypgstac/tests/test_load.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import asyncio
2+
from pathlib import Path
3+
import unittest
4+
5+
from pypgstac.pypgstac import load_ndjson, loadopt, tables
6+
7+
HERE = Path(__file__).parent
8+
TEST_DATA_DIR = HERE.parent.parent / "test" / "testdata"
9+
TEST_COLLECTIONS = TEST_DATA_DIR / "collections.ndjson"
10+
TEST_ITEMS = TEST_DATA_DIR / "items.ndjson"
11+
12+
13+
class LoadTest(unittest.TestCase):
14+
def test_load_testdata_succeeds(self) -> None:
15+
asyncio.run(
16+
load_ndjson(
17+
str(TEST_COLLECTIONS), table=tables.collections, method=loadopt.upsert
18+
)
19+
)
20+
asyncio.run(
21+
load_ndjson(str(TEST_ITEMS), table=tables.items, method=loadopt.upsert)
22+
)

0 commit comments

Comments
 (0)