diff --git a/ipywidgets/widgets/tests/test_interaction.py b/ipywidgets/widgets/tests/test_interaction.py index 19a82bb236..7d44098694 100644 --- a/ipywidgets/widgets/tests/test_interaction.py +++ b/ipywidgets/widgets/tests/test_interaction.py @@ -254,7 +254,12 @@ def test_iterable_tuple(): check_widgets(c, lis=d) def test_mapping(): - from collections.abc import Mapping + try: + # Python 3 + from collections.abc import Mapping + except ImportError: + # Python 2 + from collections import Mapping class TestMapping(Mapping): def __init__(self, values): self.values = values