matthewdeanmartin / openmock

Python Opensearch Mock for test purposes (fork of elasticmock)
https://pypi.python.org/pypi/openmock
MIT License
12 stars 11 forks source link

Add support for range queries on range fields #4

Closed BradHolmes closed 1 year ago

BradHolmes commented 1 year ago

Hello,

First off, this is a wonderful little library and a huge help to our team as we consider adopting OpenSearch. Thank you for providing this, and having such wonderful unit testing suite to boot!

In this PR, I have added support for range queries on ranged fields, at least to the extent that we currently have need. If I missed something, I'd be happy to try to add support for it as well.

I also took the liberty to refactor some of the comparison code so I could better understand it. But I'm willing to undo that refactoring if is not consistent with the style of the project.

Thank you for your review and consideration! -Brad

BradHolmes commented 1 year ago

I see I have left off a dependency change, which resulted in bumping the python version:

 [tool.poetry.dependencies]
-python = ">=3.8,<4"
+python = ">=3.9,<4"
 opensearch-py = "*"
 python-dateutil = "*"
+python-ranges = "^1.2.1"

@matthewdeanmartin : Are you ok with limiting openmock to python >= 3.9 ?

matthewdeanmartin commented 1 year ago

looks good to me. The pyproject.toml has the python ver range that matters.

BradHolmes commented 1 year ago

I'm afraid that anyone who installs this package will get an error, because the dependency python-ranges will not be added to their environment.

Also, I see this morning I left in a debug print statement on line 69.

I'll open a new PR with those changes.

BradHolmes commented 1 year ago

Opened https://github.com/matthewdeanmartin/openmock/pull/5

matthewdeanmartin commented 1 year ago

This is finally pushed to pypi.