Coverage for mlprodict/grammar/grammar_sklearn/g_sklearn_type_helpers.py: 100%
3 statements
« prev ^ index » next coverage.py v7.1.0, created at 2023-02-04 02:28 +0100
« prev ^ index » next coverage.py v7.1.0, created at 2023-02-04 02:28 +0100
1# -*- coding: utf-8 -*-
2"""
3@file
4@brief Tiny helpers for scikit-learn exporters.
5"""
8def check_type(model, model_type):
9 """
10 Raises an exception if the model is not of the expected type.
12 @param model *scikit-learn* model
13 @param model_type expected type
14 """
15 if not isinstance(model, model_type):
16 raise TypeError( # pragma: no cover
17 f"Model type {type(model)} is not of type {model_type}.")