Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

timdawborn
Copy link
Contributor

This extends PR #113 with two additional test methods: test_no_cache_values and test_no_cache_values_list. These methods provide an assertion of the behaviour indicated by the documentation regarding calls to .values() and .values_list(). That is, that queries involving these calls are not cached.

This PR was written as a prefix to bug report #116 to do with Django 1.9.

Note: the travis tests are failing because of an unpinned version install on flake8. If you bump travis to rerun master, it will fail for the same reason due to additional checks introduced in flake8 since travis was last run on master.

django-cache-machine's behaviour with the `.values` and `.values_list`
methods on a `QuerySet`. That is, not to cache the results.
@timdawborn timdawborn changed the title Dont cache values and values list Don't cache values() and values_list() Feb 10, 2016
a = [x for x in Addon.objects.all() if x.id == 1][0]
assert a.from_cache is False
self.assertIs(a.from_cache, False)
Copy link

Choose a reason for hiding this comment

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

Couldn't this (and all other similar asserts) be rewritten as self.assertFalse(a.from_cache)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it could. I simply performed a regex find and replace from the native asserts to their unit testing method calls.

Copy link

Choose a reason for hiding this comment

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

If I get the time and motivation, I may take this PR and tweak it to use those assert functions instead then.

Thanks!

@vkurup
Copy link
Contributor

vkurup commented Oct 13, 2017

Thanks. A similar change was included in #125, just merged, so I'll close this one.

@vkurup vkurup closed this Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants