Commit graph

11 commits

Author SHA1 Message Date
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
7e23033d84
There is no 'too deep nesting' 2021-09-15 11:58:13 +02:00
2d08afa309
Upgrade sqlalchemy
Adapt code to prevent new warnings and errors (as of SQLAlchemy 1.4):
- Overlapping foreign key columns could be set in a conflicting way
  => This is prevented by the application logic
  => Ignore the warning by setting a `overlaps` flag
- Transaction already rolled back
  => This only happens when tests cause an `IntegrityError` on purpose
  => Filter away the corresponding warning in the fixture
- Query returns `Row` objects and not scalars
  => Add genexpr to pull out `primary_id`
2021-09-12 16:52:51 +02:00
3bef9ca38d
Remove flake8-expression-complexity ...
... from the dev dependencies.

Longer queries in SQLAlchemy get flagged even though they are not
complicated. Other expressions are generally not that complicated.
2021-09-12 16:52:44 +02: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
1bfc7db916
Make Grid.gridify() use only pickup addresses
- ensure a `Restaurant` only has one unique `Order.pickup_address`
- rework `Grid.gridify()` so that only pickup addresses are assigned
  into `Pixel`s
- include database migrations to ensure the data adhere to these
  tighter constraints
2021-01-24 19:04:39 +01:00
de3e489b39
Adjust flake8 to not consider constants magic 2021-01-24 18:31:02 +01:00
daa224d041
Rename _*_id columns into just *_id 2021-01-05 22:37:12 +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
3e0300cb0e
Disable too-few-public-methods error in pylint 2020-12-16 11:04:43 +01:00
fdcc93a1ea
Add an ORM layer
- use SQLAlchemy (and PostgreSQL) to model the ORM layer
- add the following models:
  + Address => modelling all kinds of addresses
  + City => model the three target cities
  + Courier => model the UDP's couriers
  + Customer => model the UDP's customers
  + Order => model the orders received by the UDP
  + Restaurant => model the restaurants active on the UDP
- so far, the emphasis lies on expression the Foreign Key
  and Check Constraints that are used to validate the assumptions
  inherent to the cleanded data
- provide database-independent unit tests with 100% coverage
- provide additional integration tests ("e2e") that commit data to
  a PostgreSQL instance to validate that the constraints work
- adapt linting rules a bit
2020-08-11 10:28:17 +02:00