Commit Graph
217 Commits
Author SHA1 Message Date
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 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
Bastien Gérard b9cc8a4ca9 refactor more field tests into submodules #1983 2019-02-24 10:24:12 +01:00
Bastien Gérard 28606e9985 refactor fields tests (float, int, lazyref, long, url) #1983 2019-02-24 10:24:12 +01:00
Bastien GérardandGitHub 6cfe6652a3 Merge pull request #2001 from bagerard/separate_date_fields_tests_into_submodules
Separate fields tests into separate modules (date/datetime/complexdt)
2019-02-19 20:57:15 +01:00
Bastien Gérard 201f3008b1 Fix for py3 in binary field test 2019-02-17 22:56:56 +01:00
Bastien Gérard e02261be6d add test coverage for #1557 2019-02-17 22:22:29 +01:00
Bastien Gérard 2919e6765c separate test on binary field (#1983) 2019-02-17 21:45:05 +01:00
Bastien Gérard 4a46f5f095 Separate fields tests into separate modules (date/datetime/complexdatetime)
relates to #1983
2019-02-17 21:32:46 +01:00
Hendri KarismaandBastien Gérard a32c893078 in the mid DictField key can accept dollar sign 2018-12-19 20:24:28 +01:00
erdenezulandGitHub d3a592e5bf Merge pull request #1913 from bagerard/1453_mapfield_list_reference_field
Fix complex combinations of DictField(ListField(ReferenceField))
2018-12-13 09:16:19 +08:00
Bastien Gérard c306d42d08 Fix bug #1733 of _delta method (Issue with DynamicDocument and default value) + add test case 2018-11-13 20:57:41 +01:00
Bastien Gérard 23324f0f87 minor fix in ImageField docstring 2018-11-04 22:14:27 +01:00
Bastien Gérard 14d861bcbb Merge branch 'master' of https://github.com/MongoEngine/mongoengine into generic_ref_field_changed 2018-10-30 23:21:19 +01:00
Bastien Gérard f6cd349a16 Fix bug when using GenericReferenceField, modifications to the referenced document are tracked in the parent #1934 2018-10-30 23:00:05 +01:00