thinkingmachines / geomancer

Automated feature engineering for geospatial data
MIT License
216 stars 16 forks source link

Add unit tests #14

Closed ljvmiranda921 closed 5 years ago

ljvmiranda921 commented 5 years ago

The main challenge here is to mock the bigquery client. Still not sure how this will all work, but we should have atleast good test coverage for this project.

marksteve commented 5 years ago

We can use https://www.gaia-gis.it/fossil/libspatialite/index to test SQL queries without querying BQ directly

ljvmiranda921 commented 5 years ago

I can take a look at this this weekend! So main idea is to create test fixtures from a SQLite DB

ljvmiranda921 commented 5 years ago

Some notes:

import sqlite3
conn = sqlite3.connect('test_source.sqlite')
conn.enable_load_extension(True)

try:
    conn.load_extension('mod_spatialite.so')
except OperationalError:
    conn.load_extension('libspatialite.so')

cursor = conn.cursor()
cursor.execute(QUERY)

More info on mod_spatialite.so