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

Add test for incorrect mutation error #627

Closed
wants to merge 2 commits into from

Conversation

iscai-msft
Copy link
Contributor

What do these changes do?

I'm reproing the pypy issue I found here #620

Are there changes in behavior for the user?

No

Related issue number

620

Checklist

  • [x ] I think the code is well written
  • [ x] Unit tests for the changes exist
  • [ x] Documentation reflects the changes
  • [x ] Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> (e.g. 588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the PR
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: Fix issue with non-ascii contents in doctest text files.

@codecov
Copy link

codecov bot commented Sep 22, 2021

Codecov Report

Merging #627 (f90225b) into master (9dde0bd) will decrease coverage by 0.60%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #627      +/-   ##
==========================================
- Coverage   93.78%   93.18%   -0.61%     
==========================================
  Files           5        5              
  Lines         499      499              
==========================================
- Hits          468      465       -3     
- Misses         31       34       +3     
Flag Coverage Δ
unit 93.18% <ø> (-0.61%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
multidict/_compat.py 80.00% <0.00%> (-20.00%) ⬇️
multidict/__init__.py 88.88% <0.00%> (-11.12%) ⬇️

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 9dde0bd...f90225b. Read the comment docs.

@Dreamsorcerer
Copy link
Member

Probably needs to go in test_mutable_multidict.py, as half the test iterations are failing due to immutable classes being used.

However, it looks like this test fails on all platforms, not just pypy.

Of the 4 iterations, only the multidict._multidict-CIMultiDict class actually passes and allows this behaviour. I see that this one is skipped on pypy, so that class is probably not supported on pypy. But, on all platforms the multidict._multidict_py-CIMultiDict version fails here.

Not sure what the correct behaviour is, but it looks like the C optimised version allows this mutation, while the python version does not. Presumably the C optimised version is used by default on CPython, but is not supported on pypy.

@Dreamsorcerer
Copy link
Member

A regular dict does support this behaviour:

>>> d = {"a": "123, 456", "b": "789"}
>>> before_mutation_items = d.items()
>>> d["c"] = "000"
>>> list(before_mutation_items)
[('a', '123, 456'), ('b', '789'), ('c', '000')]

So, I'd say the Python version of multidict should probably support this as well.

@Dreamsorcerer Dreamsorcerer changed the title add pypy test Add test for incorrect mutation error Sep 22, 2021
@asvetlov
Copy link
Member

Thanks a lot for the report and test.
#628 should fix the bug

@asvetlov asvetlov closed this Sep 30, 2021
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