Skip to content

Conversation

kawa-kokosowa
Copy link
Contributor

@kawa-kokosowa kawa-kokosowa commented Jun 17, 2017

Provide a keyword query_string to cached decorator in order
to create the same cache key for different query string requests,
so long as they have the same key/value pairs (order does not matter).

Create tests for aforementioned.

Provide a keyword `query_string` to `cached` decorator in order
to create the same cache key for different query string requests,
so long as they have the same key/value (order does not matter).

Create tests for aforementioned. However, I was having troubles
getting tests to run locally `EOFError: Ran out of input`, but
we'll see the results on Travis CI pop up soon!
@kawa-kokosowa
Copy link
Contributor Author

kawa-kokosowa commented Jun 17, 2017

Looks like there's an error for Python 3.5 (though this feature works for Python 3.5.2 on the https://github.com/opensyllabus/osp-api project and is tested). I believe the errors below are unrelated to my changes (it passes for two other versions of Python on Travis CI):

FAIL: test_10a_arg_kwarg_memoize_var_keyword (test_cache.CacheFilesystemTestCase)

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/build/sh4nks/flask-caching/test_cache.py", line 363, in test_10a_arg_kwarg_memoize_var_keyword

    assert f(1, 2, d=5, e=8) == f(1, 2, e=8, d=5)

AssertionError

======================================================================

FAIL: test_10a_arg_kwarg_memoize_var_keyword (test_cache.CacheRedisTestCase)

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/build/sh4nks/flask-caching/test_cache.py", line 363, in test_10a_arg_kwarg_memoize_var_keyword

    assert f(1, 2, d=5, e=8) == f(1, 2, e=8, d=5)

AssertionError

======================================================================

FAIL: test_10a_arg_kwarg_memoize_var_keyword (test_cache.CacheTestCase)

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/build/sh4nks/flask-caching/test_cache.py", line 363, in test_10a_arg_kwarg_memoize_var_keyword

    assert f(1, 2, d=5, e=8) == f(1, 2, e=8, d=5)

AssertionError

@sh4nks sh4nks merged commit 10905fd into pallets-eco:master Jun 17, 2017
@sh4nks
Copy link
Collaborator

sh4nks commented Jun 17, 2017

Thanks, I appreciate it!
btw, I am not sure why the tests are failing (see #27)
Right now I am in the process of rewriting the tests to use pytest and to be more modular - after that I'll try to refactor the code a bit because it's kind of a mess at the moment.

@kawa-kokosowa
Copy link
Contributor Author

kawa-kokosowa commented Jun 17, 2017

My pleasure @sh4nks! Thanks for being so communicative and expedient!

with any cache-able resource response. The time in the response
can verify that two requests with the same query string
parameters/values, though differently ordered, produce responses
with the same `cache_timestamp`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same time, not cache_timestmap.

* GET /v1/works?limit=15&mock=true&offset=20

Caching functionality is verified by time from response included
with any cache-able resource response. The time in the response
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verified by a @cached route /works which produces a time in its response.

@sh4nks
Copy link
Collaborator

sh4nks commented Jun 17, 2017

I have updated the docstring - I think it's fine now.
See 2cd1722.

@sh4nks
Copy link
Collaborator

sh4nks commented Jun 17, 2017

btw, I have pushed version 1.3.0 to pypi.

@kawa-kokosowa
Copy link
Contributor Author

@sh4nks That's wonderful! I'll use that on osp-api! Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants