MCPcopy Create free account
hub / github.com/dagger/dagger / TestNameOverrides

Method TestNameOverrides

core/integration/module_python_test.go:1814–1837  ·  view source on GitHub ↗
(ctx context.Context, t *testctx.T)

Source from the content-addressed store, hash-verified

1812}
1813
1814func (PythonSuite) TestNameOverrides(ctx context.Context, t *testctx.T) {
1815 c := connect(ctx, t)
1816
1817 modGen := pythonModInit(t, c, `
1818 from typing import Annotated
1819
1820 from dagger import Name, field, function, object_type
1821
1822 @object_type
1823 class Test:
1824 field_: str = field(name="field")
1825
1826 @function(name="func")
1827 def func_(self, arg_: Annotated[str, Name(name="arg")] = "") -> str:
1828 return ""
1829 `)
1830
1831 obj := inspectModuleObjects(ctx, t, modGen).Get("0")
1832
1833 require.Equal(t, "field", obj.Get("fields.0.name").String())
1834 require.Equal(t, "func", obj.Get("functions.0.name").String())
1835 require.Equal(t, "arg", obj.Get("functions.0.args.0.name").String())
1836 require.Equal(t, "field", obj.Get("constructor.args.0.name").String())
1837}
1838
1839func (PythonSuite) TestReturnSelf(ctx context.Context, t *testctx.T) {
1840 c := connect(ctx, t)

Callers

nothing calls this directly

Calls 6

pythonModInitFunction · 0.85
inspectModuleObjectsFunction · 0.85
connectFunction · 0.70
GetMethod · 0.65
EqualMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected