mirror of https://github.com/jab/bidict.git
fix TypeError on b.viewitems()
This commit is contained in:
parent
57b7ec117f
commit
821c6a814c
|
@ -6,13 +6,19 @@ Changelog
|
|||
.. include:: release-notifications.rst.inc
|
||||
|
||||
|
||||
0.14.1 (2017-11-28)
|
||||
-------------------
|
||||
0.14.1 (not yet released)
|
||||
-------------------------
|
||||
|
||||
- Fix a bug where hashing a :class:`frozenbidict <bidict.frozenbidict>`\’s
|
||||
inverse (e.g. ``f = frozenbidict(); {f.inv: 'oops'}``) would result in
|
||||
``AttributeError: 'frozenbidict' object has no attribute '_hash'``.
|
||||
- Fix a bug introduced in 0.14.0 where hashing a
|
||||
:class:`frozenbidict <bidict.frozenbidict>`\’s inverse
|
||||
(e.g. ``f = frozenbidict(); {f.inv: '...'}``)
|
||||
would cause an ``AttributeError``.
|
||||
|
||||
- Fix a bug introduced in 0.14.0 for Python 2 users where calling
|
||||
:meth:`bidict.viewitems() <bidict.frozenbidict.viewitems>`
|
||||
would cause a ``TypeError``.
|
||||
Thanks Richard Sanger for
|
||||
`reporting <https://github.com/jab/bidict/issues/48>`_.
|
||||
|
||||
|
||||
0.14.0 (2017-11-20)
|
||||
|
|
|
@ -326,6 +326,6 @@ class frozenbidict(BidirectionalMapping): # noqa: N801
|
|||
values.__doc__ = "Like dict's ``values``."
|
||||
|
||||
# Use ItemsView here rather than proxying to fwdm.viewitems() so that
|
||||
# OrderedBidictBase (whose fwdm's values are nodes, not bare values)
|
||||
# ordered bidicts (whose fwdm's values are nodes, not bare values)
|
||||
# can use it.
|
||||
viewitems = ItemsView
|
||||
viewitems = lambda self: ItemsView(self)
|
||||
|
|
|
@ -211,3 +211,13 @@ inserting existing items is a no-op (i.e. it doesn't raise)::
|
|||
True
|
||||
>>> sorted(b.items(), key=lambda x: x[1])
|
||||
[('one', 1), ('two', 2), ('three', 3)]
|
||||
|
||||
Python 2 dict view APIs are supported::
|
||||
|
||||
>>> from bidict.compat import PY2
|
||||
>>> sorted(b.viewkeys()) == sorted(b.keys()) if PY2 else True
|
||||
True
|
||||
>>> sorted(b.viewvalues()) == sorted(b.values()) if PY2 else True
|
||||
True
|
||||
>>> sorted(b.viewitems()) == sorted(b.items()) if PY2 else True
|
||||
True
|
||||
|
|
Loading…
Reference in New Issue