@@ -20,6 +20,14 @@ metadata_model(FooRegressor,
20
20
target= AbstractVector{Continuous},
21
21
descr= " La di da" )
22
22
23
+ const HEADER = MLJModelInterface. doc_header (FooRegressor)
24
+
25
+ @doc """
26
+ $HEADER
27
+
28
+ Yes, we have no bananas. We have no bananas today!
29
+ """ FooRegressor
30
+
23
31
@testset " metadata" begin
24
32
setfull ()
25
33
M. implemented_methods (:: FI , M:: Type{<:MLJType} ) =
@@ -47,3 +55,34 @@ metadata_model(FooRegressor,
47
55
@test infos[:hyperparameter_types ] == (" Int64" , " Any" )
48
56
@test infos[:hyperparameter_ranges ] == (nothing , nothing )
49
57
end
58
+
59
+ @testset " doc_header(model)" begin
60
+
61
+ # we test markdown parsed strings for less fussy comparison
62
+
63
+ header = Markdown. parse (HEADER)
64
+ comparison =
65
+ """
66
+ ```
67
+ FooRegressor
68
+ ```
69
+
70
+ Model type for foo regressor, based on [FooRegressorPkg](http://existentialcomics.com/).
71
+
72
+ From MLJ, the type can be imported using
73
+
74
+ ```
75
+ FooRegressor = @load FooRegressor pkg=FooRegressorPkg
76
+ ```
77
+
78
+ Construct an instance with default hyper-parameters using the syntax
79
+ `model = FooRegressor()`. Provide keyword arguments to override hyper-parameter
80
+ defaults, as in `FooRegressor(a=...)`.
81
+ """ |> chomp |> Markdown. parse
82
+
83
+ end
84
+
85
+ @testset " document string" begin
86
+ doc = (@doc FooRegressor) |> string |> chomp
87
+ @test endswith (doc, " We have no bananas today!" )
88
+ end
0 commit comments