Commits

Jason R. Coombs committed 767d638

Fixed issue where removal of other backends was not being done properly (effectively mutated list inside loop over that list).

  • Participants
  • Parent commits 9061991

Comments (0)

Files changed (2)

File jaraco/modb/__init__.py

 
 def init():
 	# remove all other backends so only this one is used
-	map(jsonpickle.remove_backend, jsonpickle.json._backend_names)
+	orig_backends = list(jsonpickle.json._backend_names)
+	map(jsonpickle.remove_backend, orig_backends)
 	jsonpickle.load_backend(__name__, 'to_bson', 'from_bson', ValueError)
 	jsonpickle.set_preferred_backend(__name__)
 

File tests/test_main.py

 	assert 'MyDict' in str(encoded)
 	decoded = jaraco.modb.decode(encoded)
 	assert isinstance(decoded, MyDict)
+
+def test_init():
+	"If init works correctly, jaraco.modb will be the only backend."
+	assert jaraco.modb.jsonpickle.json._backend_names == ['jaraco.modb']