Test model compatibility.
()
| 140 | |
| 141 | @pytest.mark.skipif(**tm.no_sklearn()) |
| 142 | def test_model_compatibility() -> None: |
| 143 | """Test model compatibility.""" |
| 144 | path = os.path.dirname(os.path.abspath(__file__)) |
| 145 | path = os.path.join(path, "models") |
| 146 | |
| 147 | if not os.path.exists(path): |
| 148 | download(path) |
| 149 | |
| 150 | models = [ |
| 151 | os.path.join(root, f) for root, subdir, files in os.walk(path) for f in files |
| 152 | ] |
| 153 | assert len(models) == 54 |
| 154 | |
| 155 | for path in models: |
| 156 | name = os.path.basename(path) |
| 157 | if name.startswith("xgboost-"): |
| 158 | booster = xgboost.Booster(model_file=path) |
| 159 | run_booster_check(booster, name) |
| 160 | # Do full serialization. |
| 161 | booster = copy.copy(booster) |
| 162 | run_booster_check(booster, name) |
| 163 | elif name.startswith("xgboost_scikit"): |
| 164 | run_scikit_model_check(name, path) |
| 165 | else: |
| 166 | assert False |
nothing calls this directly
no test coverage detected