Skip to content

Commit dd7b8e7

Browse files
authored
test(python): Add test that register_all does not error (#14)
1 parent fc30481 commit dd7b8e7

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ geodatafusion = "0.1"
1717

1818
## Functions supported
1919

20+
Functions are explicitly modeled after the [PostGIS API](https://postgis.net/docs/reference.html). We strive to match the PostGIS API as much as possible.
21+
2022
### Geometry Constructors
2123

2224
| Name | Implemented | Description |

python/python/geodatafusion/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import TYPE_CHECKING
44

5-
from datafusion import udf
5+
from datafusion import udaf, udf
66

77
from ._rust import *
88
from ._rust import ___version
@@ -83,7 +83,8 @@ def register_all_native(ctx: SessionContext):
8383
ctx.register_udf(udf(native.ZMax()))
8484
ctx.register_udf(udf(native.MakeBox2D()))
8585
ctx.register_udf(udf(native.MakeBox3D()))
86-
ctx.register_udf(udf(native.Extent()))
86+
# https://github.com/apache/datafusion-python/issues/1237
87+
ctx.register_udaf(udaf(native.Extent())) # type: ignore
8788

8889
# constructors
8990
ctx.register_udf(udf(native.Point()))

python/tests/test_example.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

python/tests/test_register.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from __future__ import annotations
2+
3+
from datafusion import SessionContext
4+
from geodatafusion import register_all
5+
6+
7+
def test_register_all():
8+
# Ensure that register_all works without error
9+
ctx = SessionContext()
10+
register_all(ctx)

0 commit comments

Comments
 (0)