Jason R. Coombs avatar 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).

Comments (0)

Files changed (2)

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__)
 

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']
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.