()
| 163 | |
| 164 | |
| 165 | def test_external_constructor_doc(): |
| 166 | mod = Module() |
| 167 | |
| 168 | @mod.object_type |
| 169 | class External: |
| 170 | """external docstring""" |
| 171 | |
| 172 | foo: Annotated[str, Doc("a foo walks into a bar")] = "bar" |
| 173 | |
| 174 | @mod.function |
| 175 | def bar(self) -> str: |
| 176 | return self.foo |
| 177 | |
| 178 | @mod.object_type |
| 179 | class Test: |
| 180 | external = mod.function()(External) |
| 181 | alternative = mod.function(doc="still external")(External) |
| 182 | |
| 183 | obj = mod.get_object("Test") |
| 184 | assert obj.functions["external"].doc == "external docstring" |
| 185 | assert obj.functions["alternative"].doc == "still external" |
| 186 | # all functions point to the same constructor, with the same arguments |
| 187 | for fn in obj.functions.values(): |
| 188 | for param in fn.parameters.values(): |
| 189 | assert param.name == "foo" |
| 190 | assert param.doc == "a foo walks into a bar" |
| 191 | assert param.default_value == dagger.JSON('"bar"') |
| 192 | |
| 193 | |
| 194 | def test_external_alt_constructor_doc(): |
nothing calls this directly
no test coverage detected