File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 13
13
from sanic import __version__
14
14
from sanic .__main__ import main
15
15
from sanic .cli .inspector_client import InspectorClient
16
+ from sanic .models .ctx_types import REPLLocal
16
17
17
18
from .conftest import get_port
18
19
@@ -404,3 +405,25 @@ def test_command_with_renamed_command(caplog):
404
405
with patch ("sys.argv" , ["sanic" , * args ]):
405
406
lines = capture (args , caplog )
406
407
assert "BAZ" in lines
408
+
409
+
410
+ def test_add_local_method (app ):
411
+ def foo (): ...
412
+ def bar ():
413
+ """bar method docstring."""
414
+
415
+ class Luffy : ...
416
+
417
+ import os
418
+
419
+ app .repl_ctx .add (foo )
420
+ app .repl_ctx .add (bar )
421
+ app .repl_ctx .add (Luffy )
422
+ app .repl_ctx .add (os , desc = "Standard os module." )
423
+
424
+ assert REPLLocal (foo , "foo" , "" ) in app .repl_ctx ._locals
425
+ assert (
426
+ REPLLocal (bar , "bar" , "bar method docstring." ) in app .repl_ctx ._locals
427
+ )
428
+ assert REPLLocal (Luffy , "Luffy" , "" ) in app .repl_ctx ._locals
429
+ assert REPLLocal (os , "os" , "Standard os module." ) in app .repl_ctx ._locals
You can’t perform that action at this time.
0 commit comments