]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/db/test_status.py
enable flake for Python tests
[nominatim.git] / test / python / db / test_status.py
index 77135a8c7f943c13df96632aa9901e50b9aabed7..462b8e3db809a0e56dd580771fc5c4d6b92a5cd1 100644 (file)
@@ -2,7 +2,7 @@
 #
 # This file is part of Nominatim. (https://nominatim.org)
 #
-# Copyright (C) 2024 by the Nominatim developer community.
+# Copyright (C) 2025 by the Nominatim developer community.
 # For a full list of authors see the git log.
 """
 Tests for status table manipulation.
@@ -19,7 +19,8 @@ OSM_NODE_DATA = """\
 <node id="45673" visible="true" version="1" changeset="2047" timestamp="2006-01-27T22:09:10Z" user="Foo" uid="111" lat="48.7586670" lon="8.1343060">
 </node>
 </osm>
-"""
+"""  # noqa
+
 
 def iso_date(date):
     return dt.datetime.strptime(date, nominatim_db.db.status.ISODATE_FORMAT)\
@@ -43,7 +44,8 @@ def test_compute_database_date_from_osm2pgsql(table_factory, temp_db_conn, offli
 def test_compute_database_date_from_osm2pgsql_nodata(table_factory, temp_db_conn):
     table_factory('osm2pgsql_properties', 'property TEXT, value TEXT')
 
-    with pytest.raises(UsageError, match='Cannot determine database date from data in offline mode'):
+    with pytest.raises(UsageError,
+                       match='Cannot determine database date from data in offline mode'):
         nominatim_db.db.status.compute_database_date(temp_db_conn, offline=True)
 
 
@@ -56,6 +58,7 @@ def test_compute_database_date_valid(monkeypatch, place_row, temp_db_conn):
     place_row(osm_type='N', osm_id=45673)
 
     requested_url = []
+
     def mock_url(url):
         requested_url.append(url)
         return OSM_NODE_DATA
@@ -72,6 +75,7 @@ def test_compute_database_broken_api(monkeypatch, place_row, temp_db_conn):
     place_row(osm_type='N', osm_id=45673)
 
     requested_url = []
+
     def mock_url(url):
         requested_url.append(url)
         return '<osm version="0.6" generator="OpenStre'
@@ -86,8 +90,7 @@ def test_set_status_empty_table(temp_db_conn, temp_db_cursor):
     date = dt.datetime.fromordinal(1000000).replace(tzinfo=dt.timezone.utc)
     nominatim_db.db.status.set_status(temp_db_conn, date=date)
 
-    assert temp_db_cursor.row_set("SELECT * FROM import_status") == \
-             {(date, None, True)}
+    assert temp_db_cursor.row_set("SELECT * FROM import_status") == {(date, None, True)}
 
 
 def test_set_status_filled_table(temp_db_conn, temp_db_cursor):
@@ -99,8 +102,7 @@ def test_set_status_filled_table(temp_db_conn, temp_db_cursor):
     date = dt.datetime.fromordinal(1000100).replace(tzinfo=dt.timezone.utc)
     nominatim_db.db.status.set_status(temp_db_conn, date=date, seq=456, indexed=False)
 
-    assert temp_db_cursor.row_set("SELECT * FROM import_status") == \
-             {(date, 456, False)}
+    assert temp_db_cursor.row_set("SELECT * FROM import_status") == {(date, 456, False)}
 
 
 def test_set_status_missing_date(temp_db_conn, temp_db_cursor):
@@ -111,8 +113,7 @@ def test_set_status_missing_date(temp_db_conn, temp_db_cursor):
 
     nominatim_db.db.status.set_status(temp_db_conn, date=None, seq=456, indexed=False)
 
-    assert temp_db_cursor.row_set("SELECT * FROM import_status") == \
-             {(date, 456, False)}
+    assert temp_db_cursor.row_set("SELECT * FROM import_status") == {(date, 456, False)}
 
 
 def test_get_status_empty_table(temp_db_conn):
@@ -123,8 +124,7 @@ def test_get_status_success(temp_db_conn):
     date = dt.datetime.fromordinal(1000000).replace(tzinfo=dt.timezone.utc)
     nominatim_db.db.status.set_status(temp_db_conn, date=date, seq=667, indexed=False)
 
-    assert nominatim_db.db.status.get_status(temp_db_conn) == \
-             (date, 667, False)
+    assert nominatim_db.db.status.get_status(temp_db_conn) == (date, 667, False)
 
 
 @pytest.mark.parametrize("old_state", [True, False])