MCPcopy Index your code
hub / github.com/bpython/bpython / test_config

Method test_config

bpython/test/test_manual_readline.py:316–339  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

314 self.edits.add("b", g)
315
316 def test_config(self):
317 def f(cursor_offset, line):
318 return ("hi", 2)
319
320 def g(cursor_offset, line):
321 return ("hey", 3)
322
323 self.edits.add_config_attr("att", f)
324 self.assertNotIn("att", self.edits)
325
326 class config:
327 att = "c"
328
329 key_dispatch = {"c": "c"}
330 configured_edits = self.edits.mapping_with_config(config, key_dispatch)
331 self.assertTrue(configured_edits.__contains__, "c")
332 self.assertNotIn("c", self.edits)
333 with self.assertRaises(NotImplementedError):
334 configured_edits.add_config_attr("att2", g)
335 with self.assertRaises(NotImplementedError):
336 configured_edits.add("d", g)
337 self.assertEqual(
338 configured_edits.call("c", cursor_offset=5, line="asfd"), ("hi", 2)
339 )
340
341
342if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

mapping_with_configMethod · 0.80
callMethod · 0.80
add_config_attrMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected