]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/test_db_connection.py
port index creation to python
[nominatim.git] / test / python / test_db_connection.py
index ce81c4f3995330c9f5d6b89b462d3e05669a112c..5de686182fc2d3d90c67c68a165ed634f6e40920 100644 (file)
@@ -78,6 +78,14 @@ def test_cursor_scalar_many_rows(db):
             cur.scalar('SELECT * FROM pg_tables')
 
 
             cur.scalar('SELECT * FROM pg_tables')
 
 
+def test_cursor_scalar_no_rows(db, table_factory):
+    table_factory('dummy')
+
+    with db.cursor() as cur:
+        with pytest.raises(RuntimeError):
+            cur.scalar('SELECT id FROM dummy')
+
+
 def test_get_pg_env_add_variable(monkeypatch):
     monkeypatch.delenv('PGPASSWORD', raising=False)
     env = get_pg_env('user=fooF')
 def test_get_pg_env_add_variable(monkeypatch):
     monkeypatch.delenv('PGPASSWORD', raising=False)
     env = get_pg_env('user=fooF')