---------------------------------------------------------------------- This is the API documentation for the gdtest_mock_code library. ---------------------------------------------------------------------- ## Functions Utility functions add(a: int, b: int) -> int Add two numbers. Parameters ---------- a First number. b Second number. Returns ------- int Sum of a and b. Examples -------- ```python from gdtest_mock_code import add add(2, 3) ``` greet(name: str) -> str Greet someone by name. Parameters ---------- name The person to greet. Returns ------- str A greeting string. multiply(a: int, b: int) -> int Multiply two numbers. Parameters ---------- a First number. b Second number. Returns ------- int Product of a and b. ---------------------------------------------------------------------- This is the User Guide documentation for the package. ---------------------------------------------------------------------- ### Basic Mock Cell A basic mock cell splits display code from eval code. ```{python} #| source-code: mock import gdtest_mock_code gdtest_mock_code.add(10, 20) # --- from gdtest_mock_code import add add(10, 20) ``` The reader sees `gdtest_mock_code.add(10, 20)` but the cell actually runs `from gdtest_mock_code import add; add(10, 20)`. ### Mock with Output Title Combines `source-code: mock` with `output-title`. ```{python} #| source-code: mock #| output-title: Addition Result gdtest_mock_code.add(3, 4) # --- from gdtest_mock_code import add add(3, 4) ``` The output should appear inside a titled container labelled "Addition Result". ### Standalone Output Title `output-title` works on regular (non-mock) executable cells too. ```{python} #| output-title: Greeting Output from gdtest_mock_code import greet greet("World") ``` The output should appear inside a titled container labelled "Greeting Output". ### No Delimiter Mock A mock cell with no `# ---` delimiter is display-only (equivalent to `eval: false`). ```{python} #| source-code: mock gdtest_mock_code.multiply(6, 7) ``` There is no eval cell emitted, so no output appears. ### Multiple Mock Cells A page with several mock cells interleaved with prose. ## First calculation ```{python} #| source-code: mock gdtest_mock_code.add(1, 2) # --- from gdtest_mock_code import add add(1, 2) ``` ## Second calculation ```{python} #| source-code: mock #| output-title: Product gdtest_mock_code.multiply(3, 4) # --- from gdtest_mock_code import multiply multiply(3, 4) ``` ## Third — a greeting ```{python} #| source-code: mock #| output-title: Greeting gdtest_mock_code.greet("GDG") # --- from gdtest_mock_code import greet greet("GDG") ``` ### HTML Repr with Output Title When `output-title` wraps a rich HTML object like a GT table the container should go frameless — no double border. ### GT table with output-title ```{python} #| source-code: mock #| output-title: Example Table import great_tables as gt import pandas as pd gt.GT(pd.DataFrame({"x": [1, 2], "y": [3, 4]})) # --- from great_tables import GT import pandas as pd GT(pd.DataFrame({"x": [1, 2], "y": [3, 4]})) ``` ### GT table without output-title (baseline) ```{python} #| source-code: mock import great_tables as gt import pandas as pd gt.GT(pd.DataFrame({"a": [10, 20], "b": [30, 40]})) # --- from great_tables import GT import pandas as pd GT(pd.DataFrame({"a": [10, 20], "b": [30, 40]})) ``` ### Plain text with output-title (framed) ```{python} #| output-title: Text Output from gdtest_mock_code import greet greet("comparison") ``` The GT table with output-title should show a floating label with no frame. The baseline GT table (no output-title) should render identically to any other GT table. The text output should keep its frame. ### Output Frame (No Title) The `output-frame` option adds a bordered container around cell output without a title label. ### Framed output (no title) ```{python} #| output-frame: true from gdtest_mock_code import greet greet("framed") ``` ### Framed output with mock cell ```{python} #| source-code: mock #| output-frame: true gdtest_mock_code.add(5, 5) # --- from gdtest_mock_code import add add(5, 5) ``` ### Unframed output (baseline) ```{python} from gdtest_mock_code import greet greet("no frame") ``` The first two outputs should have a border but no title header. The third should render as a normal cell output.