@@ -158,7 +158,8 @@ FooRegressor
158
158
```
159
159
160
160
A model type for constructing a foo regressor, based on
161
- [FooRegressorPkg.jl](http://existentialcomics.com/).
161
+ [FooRegressorPkg.jl](http://existentialcomics.com/), and implementing the MLJ model
162
+ interface.
162
163
163
164
From MLJ, the type can be imported using
164
165
@@ -171,9 +172,69 @@ Provide keyword arguments to override hyper-parameter
171
172
defaults, as in `FooRegressor(a=...)`.
172
173
""" |> chomp |> Markdown. parse
173
174
175
+ @test string (header) == string (comparison)
174
176
end
175
177
176
178
@testset " document string" begin
177
179
doc = (@doc FooRegressor) |> string |> chomp
178
180
@test endswith (doc, " We have no bananas today!" )
179
181
end
182
+
183
+
184
+ # # DOC STRING - AUGMENTED CASE
185
+
186
+ """ Cool model"""
187
+ @mlj_model mutable struct FooRegressor2 <: Deterministic
188
+ a:: Int = 0 :: (_ ≥ 0)
189
+ b
190
+ end
191
+
192
+ metadata_pkg (FooRegressor2,
193
+ name= " FooRegressor2Pkg" ,
194
+ uuid= " 10745b16-79ce-11e8-11f9-7d13ad32a3b2" ,
195
+ url= " http://existentialcomics.com/" ,
196
+ julia= true ,
197
+ license= " MIT" ,
198
+ is_wrapper= false
199
+ )
200
+
201
+ # this is added in MLJBase but not in MLJModelInterface, to avoid
202
+ # InteractiveUtils as dependency:
203
+ setfull ()
204
+ M. implemented_methods (:: FI , M:: Type{<:MLJType} ) =
205
+ getfield .(methodswith (M), :name )
206
+
207
+ const HEADER2 = MLJModelInterface. doc_header (FooRegressor2, augment= true )
208
+
209
+ @doc """
210
+ $HEADER2
211
+
212
+ Yes, we have no bananas. We have no bananas today!
213
+ """ FooRegressor2
214
+
215
+ @testset " doc_header(ModelType, augment=true)" begin
216
+
217
+ # we test markdown parsed strings for less fussy comparison
218
+
219
+ header = Markdown. parse (HEADER2)
220
+ comparison =
221
+ """
222
+ From MLJ, the `FooRegressor2` type can be imported using
223
+
224
+ ```
225
+ FooRegressor2 = @load FooRegressor2 pkg=FooRegressor2Pkg
226
+ ```
227
+
228
+ Do `model = FooRegressor2()` to construct an instance with default hyper-parameters.
229
+ Provide keyword arguments to override hyper-parameter
230
+ defaults, as in `FooRegressor2(a=...)`.
231
+ """ |> chomp |> Markdown. parse
232
+
233
+ @test string (header) == string (comparison)
234
+
235
+ end
236
+
237
+ @testset " document string" begin
238
+ doc = (@doc FooRegressor2) |> string |> chomp
239
+ @test endswith (doc, " We have no bananas today!" )
240
+ end
0 commit comments