diff --git a/mopidy/models.py b/mopidy/models.py index 35f1f9eb..af409570 100644 --- a/mopidy/models.py +++ b/mopidy/models.py @@ -224,6 +224,8 @@ class ImmutableObject(object): :type values: dict :rtype: new instance of the model being copied """ + if not values: + return self other = copy.copy(self) for key, value in values.items(): if key not in self._fields: diff --git a/tests/models/test_models.py b/tests/models/test_models.py index 8f72dd34..ef484fa9 100644 --- a/tests/models/test_models.py +++ b/tests/models/test_models.py @@ -12,7 +12,7 @@ class GenericCopyTest(unittest.TestCase): def compare(self, orig, other): self.assertEqual(orig, other) - self.assertNotEqual(id(orig), id(other)) + self.assertEqual(id(orig), id(other)) def test_copying_track(self): track = Track()