Allow dot'ted field in connectFrom of $graphLookup aggregation pipeline by arunl · Pull Request #686 · mongomock/mongomock

added 4 commits

December 31, 2020 01:12
Modified the original code. Split the connectFrom parameters, and
recursively traverse the split list and the document (in parallel).
If the value of a parameter is a list, it traverses all the elements
of the list. If a dictionary, it traverses values of the
matching key.

@arunl arunl mentioned this pull request

Dec 31, 2020

@arunl

@arunl

@arunl

Removed parameterized test using pytest. Replaced with unittest.
I am guessing unittest is preferred for compatibility with other
versions and operating environments.
Why? For python 2.7 compatibility

@arunl

@arunl

The function '_recursive_get' had yield-from, which is not supported by
python 2.7. I thought I had changed it to an iterative yield. Turns out
I had duplicate copy of this function. I had been changing one, and the
other one was triggering Travis CI failure. I hope this settles the
issue.
I was earlier using assertEqual(actual, expected), which was good enough
for my work. I expected it would break somepoint. And it broke the CI.

Looking around for options I lucked into the 'test__diff.py', and
learned about 'tests.diff'. Am using that now instead.

@arunl

@arunl

Am flummoxed by this violation. Cannot recreate it on my machine. flake8
ran independently gives no error. tox -e pep8 (with python 3.6.7 and
3.8) errors out, with an exception that FlakeChecker doesn't have an
  attribute CONSTANT.
Required a lot of work for, in my opinion, a very superfluous coding
standard. To beat it I changed the docstring to be a single line
comment. It made the comment less readable, but it got me past H405.

The bright side, I was able to recreate the issue on my machine. It
required making a change to pyflakes/checker.py. For anyone experiencing
the same problem, here is the fix I used:

In pyflakes 1.2.3, file pyflakes/checker.py, change line 854

from:

        STARRED = NAMECONSTANT = handleChildren
to:
        STARRED = NAMECONSTANT = CONSTANT = handleChildren

@arunl

pcorpet

@arunl

@arunl

- Moved test cases into test__collection.py
- Refactored aggregate.py for better code

@arunl

@arunl

@arunl

pcorpet

@arunl

pcorpet

@pcorpet