Commit graph velofy/tests/db/fake_data
Author SHA1 Message Date
2f1afd459f
Break multi-line comments before conjunctions 2026-12-03 10:13:13 +01:00
049a5f6f62
Remove periods from one-sentence comments 2026-12-03 10:04:43 +01:00
732a74be1c
Declare __all__ in all re-exporting packages
Then, the linters know the imports are re-exports and not unused.
2026-12-03 09:44:07 +01:00
8abc93987e
Generate the fake coordinates as floats
Also, remove the misleading comment in `Location`
2026-12-01 15:27:53 +01:00
0090145b65
Capitalize the explanations after "=>" 2026-11-30 23:27:31 +01:00
ae2dc8db64
Enable EM in flake8 and ruff 2026-11-30 22:59:41 +01:00
5beb88559f
Enable FBT in flake8 and ruff 2026-11-30 22:43:35 +01:00
3bd7dd5772
Enable RET in flake8 and ruff 2026-11-30 22:06:42 +01:00
07660ecff9
Import geopy.distance as geo_distance everywhere 2026-11-30 20:01:42 +01:00
aa1a7c796f
Register the shared fixtures via pytest_plugins
That is the documented way to share fixtures from other modules,
instead of importing them into tests/conftest.py
2026-11-30 15:03:27 +01:00
ee5a372b2b
Link new objects from the parent
Since SQLAlchemy 2.0, only the parent's end
cascades a new object into the session'
2026-11-30 10:40:27 +01:00
e451f03d0f
Add ruff to the "format" session
`ruff format` adds parentheses around multi-line lambda bodies
and removes blank lines after block openers,
both of which `black` accepts.

Lines with `# type:ignore` are shortened
because `black` counts pragma comments toward the line length
and `ruff` does not.
2026-11-28 04:44:52 +01:00
4a81403f15
Replace darglint with pydoclint 2026-11-28 04:06:53 +01:00
ea8f1a13e3
Use double quotes 2026-11-28 03:26:13 +01:00
7f14c9c855
Add flake8-commas 2026-11-28 03:26:11 +01:00
137b3b1e03
Remove the config of flake8-expression-complexity 2026-11-28 03:26:10 +01:00
9fcb3c8c14
Remove all "WPS" codes 2026-11-28 03:25:20 +01:00
042256eb99
Switch to Python 3.13
All checks were successful
CI / Tests (Python 3.13) (push) Successful in 1m17s
The dependencies stay in the same series as on Python 3.8
where those support 3.13.

Only the unavoidable upgrades are taken:
 - `matplotlib` to v3.9
 - `numpy` to v2.1
 - `pandas` to v2.2
 - `scipy` (via statsmodels)

Required code changes:
- `numpy` v2.1 prints its scalars as `np.float64(...)`,
  which `psycopg2` then writes into the SQL
  => Adjust `Forecast.from_dataframe()` to convert the
     rounded values into plain `float`s
- Python 3.12 no longer accepts `float`s in `random.randint()`
  => The test factories now pass the seconds as `int`s

CI and `nox` use a `u`v-managed Python, which ships the C headers
needed to build `psycopg2` and `rpy2`.

`flake8` v4 does not run on Python 3.12+
and is upgraded in a future commit.
2026-11-25 11:30:33 +01:00
dbdce83067
Upgrade black 2026-11-25 10:30:47 +01:00
4855209392
Rename the urban_meal_delivery package into velofy 2026-11-23 18:06:53 +01:00
e4e543bd40
Add ORM models for the simulation data
- add new ORM models `ReplaySimulation` and `ReplayedOrder`
  to store the data generated by the routing simulations
- add migrations script to create the corresponding database tables
  + create "replay_simulations" and "replayed_orders" tables
  + add missing check constraints to "orders" table
  + add unique constraint to "orders" table to enable compound key
  + drop unnecessary check constraints from the "orders" table
- add tests for the new ORM models
  + add `simulation`, `replayed_order`, `make_replay_order()`, and
    `pre_order` fixtures
  + add `ReplayedOrderFactor` faker class
- fix some typos
2021-09-16 11:58:55 +02:00
41f75f507d
Use a unified DATE constant for convenience 2021-09-16 11:53:40 +02:00
f0eb9d3b6f
There is no 'too complex function'
We check a function's cognitive complexity only with `mccabe` (=C901)
and not with WPS231 as the two overlap in most cases.
2021-09-15 14:51:56 +02:00
f891fac3dc
Refactor tests.db.fake_data.factories into a package 2021-09-15 11:58:17 +02:00
47ef1f8759
Add OrderHistory.first/last_order() methods
- get the `datetime` of the first or last order within a pixel
- unify some fixtures in `tests.forecasts.timify.conftest`
2021-01-31 21:46:20 +01:00
4b6d92958d
Add functionality for drawing folium.Maps
- this code is not unit-tested due to the complexity involving
  interactive `folium.Map`s => visual checks give high confidence
2021-01-26 17:07:50 +01:00
9196c88ed4
Remove pylint from the project 2021-01-09 17:47:45 +01:00
65d1632e98
Add OrderHistory class
- the main purpose of this class is to manage querying the order totals
  from the database and slice various kinds of time series out of the
  data
- the class holds the former `aggregate_orders()` function as a method
- modularize the corresponding tests
- add `tests.config` with globals used when testing to provide a
  single source of truth for various settings
2021-01-09 16:29:58 +01:00
daa224d041
Rename _*_id columns into just *_id 2021-01-05 22:37:12 +01:00
992d2bb7d4
Adjust flake8 ...
... to not complain about implementation details when testing.
2021-01-05 19:08:52 +01:00
f996376b13
Add ORM models for the pixel grids
- add Grid, Pixel, and AddressPixelAssociation ORM models
- each Grid belongs to a City an is characterized by the side_length
  of all the square Pixels contained in it
- Pixels aggregate Addresses => many-to-many relationship (that is
  modeled with SQLAlchemy's Association Pattern to implement a couple
  of constraints)
2021-01-03 19:33:36 +01:00
78dba23d5d
Re-factor the ORM tests to use randomized fake data
- create `*Factory` classes with fakerboy and faker that generate
  randomized instances of the ORM models
- add new pytest marker: "db" are the integration tests involving the
  database whereas "e2e" will be all other integration tests
- streamline the docstrings in the ORM models
2020-12-29 15:40:32 +01:00