| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f9b21ca commit 126b059
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -601,8 +601,6 @@ def get_args(self): | |||
| 601 | 601 | if inspect.isclass(f): | |
| 602 | 602 | class_f = None | |
| 603 | 603 | ||
| 604 | - if hasattr(f, "__init__") and f.__init__ is not object.__init__: | ||
| 605 | - class_f = f.__init__ | ||
| 606 | 604 | if ( | |
| 607 | 605 | (not class_f or not inspection.getfuncprops(func, class_f)) | |
| 608 | 606 | and hasattr(f, "__new__") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -482,6 +482,34 @@ def test_paremeter_name_completion(self): | |||
| 482 | 482 | self.repl.matches_iter.matches, ["abc=", "abd=", "abs("] | |
| 483 | 483 | ) | |
| 484 | 484 | ||
| 485 | + def test_parameter_advanced_on_class(self): | ||
| 486 | + self.repl = FakeRepl( | ||
| 487 | + {"autocomplete_mode": autocomplete.AutocompleteModes.SIMPLE} | ||
| 488 | + ) | ||
| 489 | + self.set_input_line("TestCls(app") | ||
| 490 | + | ||
| 491 | + code = """ | ||
| 492 | + import inspect | ||
| 493 | + | ||
| 494 | + class TestCls: | ||
| 495 | + # A class with boring __init__ typing | ||
| 496 | + def __init__(self, *args, **kwargs): | ||
| 497 | + pass | ||
| 498 | + # But that uses super exotic typings recognized by inspect.signature | ||
| 499 | + __signature__ = inspect.Signature([ | ||
| 500 | + inspect.Parameter("apple", inspect.Parameter.POSITIONAL_ONLY), | ||
| 501 | + inspect.Parameter("apple2", inspect.Parameter.KEYWORD_ONLY), | ||
| 502 | + inspect.Parameter("pinetree", inspect.Parameter.KEYWORD_ONLY), | ||
| 503 | + ]) | ||
| 504 | + """ | ||
| 505 | + for line in code.split("\n"): | ||
| 506 | + print(line[8:]) | ||
| 507 | + self.repl.push(line[8:]) | ||
| 508 | + | ||
| 509 | + self.assertTrue(self.repl.complete()) | ||
| 510 | + self.assertTrue(hasattr(self.repl.matches_iter, "matches")) | ||
| 511 | + self.assertEqual(self.repl.matches_iter.matches, ["apple2=", "apple="]) | ||
| 512 | + | ||
| 485 | 513 | ||
| 486 | 514 | class TestCliRepl(unittest.TestCase): | |
| 487 | 515 | def setUp(self): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments