MCPcopy Index your code
hub / github.com/python/cpython / test_suggestions_underscored

Method test_suggestions_underscored

Lib/test/test_traceback.py:4194–4214  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4192 self.assertIn('Did you mean ' + suggestion, actual)
4193
4194 def test_suggestions_underscored(self):
4195 class A:
4196 bluch = None
4197
4198 self.assertIn("'.bluch'", self.get_suggestion(A(), 'blach'))
4199 self.assertIn("'.bluch'", self.get_suggestion(A(), '_luch'))
4200 self.assertIn("'.bluch'", self.get_suggestion(A(), '_bluch'))
4201
4202 attr_function = self.attr_function
4203 class B:
4204 _bluch = None
4205 def method(self, name):
4206 attr_function(self, name)
4207
4208 self.assertIn("'._bluch'", self.get_suggestion(B(), '_blach'))
4209 self.assertIn("'._bluch'", self.get_suggestion(B(), '_luch'))
4210 self.assertNotIn("'._bluch'", self.get_suggestion(B(), 'bluch'))
4211
4212 self.assertIn("'._bluch'", self.get_suggestion(partial(B().method, '_blach')))
4213 self.assertIn("'._bluch'", self.get_suggestion(partial(B().method, '_luch')))
4214 self.assertIn("'._bluch'", self.get_suggestion(partial(B().method, 'bluch')))
4215
4216 def test_suggestions_with_custom___dir__(self):
4217 class M(type):

Callers

nothing calls this directly

Calls 6

partialClass · 0.90
assertInMethod · 0.80
get_suggestionMethod · 0.80
assertNotInMethod · 0.80
AClass · 0.70
BClass · 0.70

Tested by

no test coverage detected