Skip to content

Conversation

@hukkin
Copy link

@hukkin hukkin commented May 8, 2020

Background

It seems there is an inconsistency in how the Python and C implementations handle a Map.__init__, Mapy.update, or MapMutation.update keyword argument that is named "col". The C implementation works similarly to the builtin dict init. Python implementation seems to have some issues though.

Changes in this PR

  • Remove the special role of a kwarg called "col" from kwargs of Map.__init__, Map.update and MapMutation.update. Assume that if there is a positional arg, it must be a collection, do not care about the name "col".

@hukkin hukkin changed the title Add a test for a Map kwarg named "col" Fix errors when a kwarg is named "col" May 9, 2020
def test_kwarg_named_col(self):
self.assertEqual(dict(self.Map(col=0)), {"col": 0})
self.assertEqual(dict(self.Map(a=0, col=1)), {"a": 0, "col": 1})
self.assertEqual(dict(self.Map({"a": 0}, col=1)), {"a": 0, "col": 1})
Copy link
Author

@hukkin hukkin May 9, 2020

Choose a reason for hiding this comment

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

All of these three asserts used to fail when running in PyMapTest. They now pass with the changes in this MR.

This test makes very little sense now that the keyword arg called "col" has been refactored out, though. Should we keep it or not?

Copy link
Member

Choose a reason for hiding this comment

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

It's OK to keep it I guess.

@1st1 1st1 merged commit e0a07ab into MagicStack:master May 13, 2020
@hukkin hukkin deleted the test-kwarg-named-col branch August 13, 2020 13:22
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