Commit Graph
230 Commits
Author SHA1 Message Date
Bastien Gérard e8f6b42316 Merge branch 'master' of github.com:MongoEngine/mongoengine into fix_complex_datetime_field_invalid_string_set 2020-04-25 22:12:35 +02: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 87f4d1a323 Merge branch 'master' of github.com:MongoEngine/mongoengine into drop_py2_support 2020-04-25 13:51:21 +02:00
Bastien Gérard d9b9581df2 Merge branch 'master' of github.com:MongoEngine/mongoengine into fix_complex_datetime_field_invalid_string_set 2020-04-08 21:33:58 +02:00
Bastien Gérard 85df76c623 Merge branch 'master' of github.com:MongoEngine/mongoengine into drop_py2_support 2020-03-17 09:24:32 +01:00
Bastien Gérard 87512246cb Merge branch 'master' of github.com:MongoEngine/mongoengine into fix_dictfield_validation 2020-03-16 22:30:48 +01:00
Bastien Gérard 333e014f13 Merge branch 'master' of github.com:MongoEngine/mongoengine into fix_complex_datetime_field_invalid_string_set 2020-03-15 22:20:46 +01:00
Bastien Gérard aa4a6ae023 Fix invalid escape seq in codebase 2020-03-15 21:02:44 +01:00
Bastien Gérard 8086576677 get rid of six 2020-03-11 23:07:03 +01:00
Bastien Gérard 03e34299f0 clean code related to Py2 + six.text_type & six.string_types 2020-03-11 21:50:50 +01:00
Bastien Gérard 421e3f324f Drop python2 support 2020-03-09 00:18:52 +01:00
Bastien Gérard a0b803959c Merge branch 'master' of github.com:MongoEngine/mongoengine into py2py3_improve_compat 2020-03-08 14:44:39 +01:00
Bastien Gérard 38703acc29 fix complex datetime field invalid string set 2020-01-23 23:33:23 +01:00
Bastien Gérard d738462139 Fix bug introduced in -1.19 related to DictField validate failing without default connection 2020-01-11 23:17:05 +01:00
Bastien Gérard b5485b16e6 Merge branch 'allow-periods-in-dict' of https://github.com/mcsimps2/mongoengine into mcsimps2-allow-periods-in-dict 2019-12-26 20:47:46 +01:00
Bastien Gérard 332bd767d4 minor fixes in tests 2019-12-20 23:20:15 +01:00
Bastien Gérard 9166ba91d7 fix minor styling issue 2019-12-14 16:11:59 +01:00
Bastien Gérard 6bc4e602bb additional fix 2019-12-14 00:05:48 +01:00
Bastien Gérard 64c0cace85 fix from code review regarding py2py3 compat 2019-12-13 23:57:18 +01:00
Bastien Gérard 2ca905b6e5 Finalize python2/3 codebase compatibility and get rid of 2to3 2019-12-13 23:43:04 +01:00
Matt Simpson b205314424 Add ability for dict keys to have . or $ in MongoDB >= 3.6
Starting in MongoDB >= 3.6, it is valid for dictionary keys to have $ or . in them as long as they don't start with $.  Additional tests added.
2019-12-10 11:09:29 -05:00
Bastien Gérard 799cdafae6 remove references to nose 2019-10-31 23:02:28 +01:00
Bastien Gérard bc0c55e49a improve tests health (flake8 warnings) 2019-10-31 23:01:27 +01:00
Bastien Gérard c61c6a8525 fix == None assertions 2019-10-31 22:59:49 +01:00
Bastien Gérard 3e764d068c fix remaining assertRaises 2019-10-31 22:59:49 +01:00
Bastien Gérard ac25f4b98b ran unittest2pytest 2019-10-31 22:59:49 +01:00
Bastien Gérard 37ca79e9c5 fix black formatting 2019-10-31 22:39:53 +01:00
Bastien Gérard ddececbfea rename all test files so that they are prefixed by test_{orginal_filename}.py 2019-08-28 16:01:44 +03:00
Stefan WójcikandGitHub 609f50d261 Fix the duplicate ListField max_length test (#2110)
This is a follow-up after #2107.

Not sure what happened here, but in
https://github.com/MongoEngine/mongoengine/pull/2107/commits/87194856ecc5076bec2a186bae60c5d5b25c01ed
I committed a copy-paste of the same test instead of a test validating the
max_length behavior along with a "set" operator.
2019-06-27 16:45:31 +02:00
Stefan WójcikandGitHub 82f0eb1cbc Add a max_length param to the ListField (#2107)
This is similar to the `max_length` param of a `StringField`.

Sometimes you don't want your lists to be able to grow indefinitely.
2019-06-27 15:07:02 +02:00
Stefan WójcikandGitHub 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 27ea01ee05 refactored datetime to_mongo, separating parsing from str + added test 2019-06-04 23:16:26 +02:00
Bastien Gérard 7ed5829b2c Add test on datetime field - parse datetime as str 2019-06-04 23:16:26 +02:00
Bastien Gérard 7d0687ec73 custom field validator is now expected to raise a ValidationError (drop support for returning True/False) 2019-05-28 09:26:07 +02:00
Bastien Gérard 6e1c132ee8 Improve minor things in the tests 2019-05-26 22:17:58 +02:00
Bastien Gérard bb1089e03d Improve coverage in fields test 2019-05-17 22:16:08 +02:00
Bastien Gérard c82f0c937d more work on coverage 2019-05-17 22:04:28 +02:00
Bastien Gérard 00d2fd685a more test cov 2019-05-17 22:04:28 +02:00
Bastien Gérard f28e1b8c90 improve coverage of lazy ref field 2019-05-17 22:04:28 +02:00
Bastien Gérard f7b7d0f79e Improve tests for querying list(embedded) when using inheritance 2019-05-03 21:59:48 +02:00
Bastien Gérard d98f36ceff Add test for querying on fields of list(EmbeddedDocument) (with inheritance on the EmbededDoc) 2019-05-02 00:08:16 +02:00
Bastien Gérard abfabc30c9 Fix querying on (Generic)EmbeddedDocument subclasses fields 2019-05-01 23:23:19 +02:00
erdenezulandGitHub 50ffa8014e Merge pull request #2008 from bagerard/refactor_deprecated_pymongo_test
refactored deprecated pymongo methods in tests
2019-03-03 08:06:48 +08:00
Bastien Gérard 7ef688b256 Added a test for push in DictField (relates to #1679) 2019-03-02 22:05:23 +01:00
Bastien Gérard b4fe0b35e4 Merge branch 'master' of github.com:MongoEngine/mongoengine into refactor_deprecated_pymongo_test 2019-03-02 21:48:41 +01:00
Bastien Gérard 35b7efe3f4 refactored deprecated pymongo methods in tests
- remove/count/add_user/insert
- added pymongo_support
2019-03-02 00:28:38 +01:00
Bastien Gérard dca837b843 Add suport for Mongo 3.4 (travis, fix tests) 2019-02-26 21:38:23 +01:00
Bastien Gérard c60c2ee8d0 fix minor styling issue in tests 2019-02-25 22:33:36 +01:00
Bastien Gérard 3cdb5b5db2 fix poor assert's in tests 2019-02-25 22:29:44 +01:00