The issue seems to be
:- begin_tests(example_bad).
test(1) :-
has_type(list(key_value),[kv(1,a),kv(2,b)]).
:- end_tests(example_bad).
error:has_type/2 is multifile, but not part of the interface of library(error). Type checking is done using must_be/2 (throws error) or is_of_type/2 (fails)
:- begin_tests(example_bad).
test(1) :-
is_of_type(list(key_value),[kv(1,a),kv(2,b)]).
:- end_tests(example_bad).
With that change I get
101 ?- run_tests.
% PL-Unit: example_bad . done
% test passed
true.