13 Commits

Author SHA1 Message Date
Bastien Gerard
ff596fcb7e replace flake8-import-order by isort 2021-03-29 21:50:22 +02:00
Jan Stein
8fd969aba9 Test case and proposed solution for #2484 2021-03-03 14:58:03 +01:00
Peter Volf
e0bec881bc removed unused variable to fix a warning 2020-11-25 15:17:52 +01:00
Peter Volf
cc5e2ba054 fix LazyReferenceField dereferencing bug in embedded documents, refs #2375 2020-11-25 11:05:37 +01:00
Bastien Gérard
f4962fbc40 remove utf8 encoding declaration in test files as it's not needed/recommended 2020-10-30 21:10:21 +01:00
Bastien Gérard
ef7da36ac6 Update pre-commit and fix existing flake8 warnings once for all 2020-04-25 21:36:07 +02:00
Bastien Gérard
bc0c55e49a improve tests health (flake8 warnings) 2019-10-31 23:01:27 +01:00
Bastien Gérard
ac25f4b98b ran unittest2pytest 2019-10-31 22:59:49 +01:00
Stefan Wójcik
b47669403b
Format the codebase using Black (#2109)
This commit:
1. Formats all of our existing code using `black`.
2. Adds a note about using `black` to `CONTRIBUTING.rst`.
3. Runs `black --check` as part of CI (failing builds that aren't properly formatted).
2019-06-27 13:05:54 +02:00
Stefan Wojcik
f45552f8f8 Drop support for positional arguments when instantiating a document
For example, if you had the following class:
```
class Person(Document):
    name = StringField()
    age = IntField()
```

You could instantiate an object of such class by doing one of the following:
1. `new_person = Person('Tom', 30)`
2. `new_person = Person('Tom', age=30)`
3. `new_person = Person(name='Tom', age=30)`

From now on, only option (3) is allowed.

Supporting positional arguments may sound like a reasonable idea in this
heavily simplified example, but in real life it's almost never what you want
(especially if you use inheritance in your document definitions) and it may
lead to ugly bugs. We should not rely on the *order* of fields to match a given
value to a given name.

This also helps us simplify the code e.g. by dropping the confusing (and
undocumented) `BaseDocument._auto_id_field` attribute.
2019-06-24 15:44:35 +02:00
Bastien Gérard
bb1089e03d Improve coverage in fields test 2019-05-17 22:16:08 +02:00
Bastien Gérard
f28e1b8c90 improve coverage of lazy ref field 2019-05-17 22:04:28 +02:00
Bastien Gérard
28606e9985 refactor fields tests (float, int, lazyref, long, url) #1983 2019-02-24 10:24:12 +01:00