@@ -68,7 +68,7 @@ If `LearnAPI.is_static(learner) == false`, then:
6868 `transform` are called with no data. Otherwise, they are called with `X`.
6969
7070If instead `LearnAPI.is_static(learner) == true`, then `fit` and its cousins are called
71- without any data, and `dataset` is passed directly to `fit ` and/or `transform`.
71+ without any data, and `dataset` is passed directly to `predict ` and/or `transform`.
7272
7373"""
7474macro testapi (learner, data... )
@@ -197,8 +197,15 @@ macro testapi(learner, data...)
197197 obs (learner, data)
198198 end
199199
200- X = @logged_testset $ FEATURES verbosity begin
201- LearnAPI. features (learner, observations)
200+ X = if _is_static
201+ data
202+ else
203+ @logged_testset $ FEATURES0 verbosity begin
204+ LearnAPI. features (learner, data)
205+ end
206+ @logged_testset $ FEATURES verbosity begin
207+ LearnAPI. features (learner, observations)
208+ end
202209 end
203210
204211 if ! (isnothing (X))
@@ -437,24 +444,24 @@ macro testapi(learner, data...)
437444
438445 # target
439446
440- _y = @logged_testset $ TARGET verbosity begin
441- LearnAPI. target (learner, observations)
442- end
443-
444- if ! (isnothing (_y))
445- @logged_testset $ TARGET_IN_FUNCTIONS verbosity begin
446- Test. @test :(LearnAPI. target) in _functions
447+ if :(LearnAPI. target) in _functions
448+ _y = @logged_testset $ TARGET0 verbosity begin
449+ LearnAPI. target (learner, data)
450+ end
451+ @logged_testset $ TARGET verbosity begin
452+ LearnAPI. target (learner, observations)
447453 end
448- y = @logged_testset $ TARGET_SELECTIONS verbosity begin
454+ @logged_testset $ TARGET_SELECTIONS verbosity begin
449455 LearnTestAPI. learner_get (
450456 learner,
451457 data,
452458 data-> LearnAPI. target (learner, data),
453459 )
454- end
455- else
456- @logged_testset $ TARGET_NOT_IN_FUNCTIONS verbosity begin
457- Test. @test ! (:(LearnAPI. target) in _functions)
460+ LearnTestAPI. learner_get (
461+ learner,
462+ observations,
463+ data-> LearnAPI. target (learner, data),
464+ )
458465 end
459466 end
460467
@@ -645,19 +652,19 @@ macro testapi(learner, data...)
645652 Test. @test _human_name isa String
646653 end
647654
648- @logged_testset $ FIT_SCITYPE verbosity begin
649- S = LearnAPI . fit_scitype (learner)
650- if S == Union{}
651- push! (missing_traits, :(LearnAPI . fit_scitype))
652- else
655+ S = LearnAPI . fit_scitype (learner)
656+ if S == Union{}
657+ push! (missing_traits, :(LearnAPI . fit_scitype))
658+ else
659+ @logged_testset $ FIT_SCITYPE verbosity begin
653660 Test. @test ScientificTypes. scitype (data) <: S
654661 end
655662 end
656663
657664 S = LearnAPI. target_observation_scitype (learner)
658665 testable = :(LearnAPI. target) in _functions &&
659666 _data_interface in (LearnAPI. RandomAccess (), LearnAPI. FiniteIterable ())
660- if S == Any
667+ if S == Any && (LearnAPI . target) in _functions
661668 push! (missing_traits, :(LearnAPI. target_observation_scitype))
662669 elseif testable
663670 @logged_testset $ TARGET_OBSERVATION_SCITYPE verbosity begin
0 commit comments