MCPcopy
hub / github.com/django/django / safe_exec

Method safe_exec

tests/migrations/test_writer.py:271–282  ·  view source on GitHub ↗
(self, string, value=None)

Source from the content-addressed store, hash-verified

269 return cls.X
270
271 def safe_exec(self, string, value=None):
272 d = {}
273 try:
274 exec(string, globals(), d)
275 except Exception as e:
276 if value:
277 self.fail(
278 "Could not exec %r (from value %r): %s" % (string.strip(), value, e)
279 )
280 else:
281 self.fail("Could not exec %r: %s" % (string.strip(), e))
282 return d
283
284 def serialize_round_trip(self, value):
285 string, imports = MigrationWriter.serialize(value)

Callers 3

serialize_round_tripMethod · 0.95
test_simple_migrationMethod · 0.95
test_custom_operationMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected