Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid/non-representative tests #1064

Closed
wants to merge 1 commit into from
Closed

Fix invalid/non-representative tests #1064

wants to merge 1 commit into from

Conversation

jdufresne
Copy link
Member

Passing bytes objects to a model CharField (a string field) is not
supported and incorrect use of the API. When Python is started with -b,
it can result in the warnings:

.../django/db/models/fields/__init__.py:1078: BytesWarning: str() on a bytes instance
  return str(value)
.../django/db/models/fields/__init__.py:1078: BytesWarning: str() on a bytes instance
  return str(value)

Avoid this warning by passing str values, as expected.

For details on the Python -b flag, see:

https://docs.python.org/3/using/cmdline.html#miscellaneous-options

Passing bytes objects to a model CharField (a string field) is not
supported and incorrect use of the API. When Python is started with -b,
it can result in the warnings:

.../django/db/models/fields/__init__.py:1078: BytesWarning: str() on a bytes instance
  return str(value)
.../django/db/models/fields/__init__.py:1078: BytesWarning: str() on a bytes instance
  return str(value)

Avoid this warning by passing str values, as expected.

For details on the Python -b flag, see:

https://docs.python.org/3/using/cmdline.html#miscellaneous-options
@codecov
Copy link

codecov bot commented Jun 10, 2018

Codecov Report

Merging #1064 into master will decrease coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1064      +/-   ##
==========================================
- Coverage   84.08%   83.93%   -0.16%     
==========================================
  Files          24       24              
  Lines        1301     1301              
  Branches      178      178              
==========================================
- Hits         1094     1092       -2     
- Misses        157      159       +2     
  Partials       50       50
Impacted Files Coverage Δ
debug_toolbar/panels/sql/panel.py 62.41% <0%> (-1.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c74fef5...440d47a. Read the comment docs.

@matthiask
Copy link
Member

Hmm. It is incorrect use of the queryset API, but doesn't it still make sense to test that django-debug-toolbar doesn't crash in this case?

@jdufresne
Copy link
Member Author

A use case for binary values is querying by a BinaryField. I'll see if there is a better way to handle this.

@jdufresne jdufresne closed this Oct 26, 2018
@jdufresne jdufresne deleted the invalid-tests branch October 26, 2018 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants