Skip to content

Commit 5cfd47b

Browse files
committed
data: add tests for msweb source
1 parent 9dd590f commit 5cfd47b

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

tests/data/test_load_msweb.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This file is part of LensKit.
2+
# Copyright (C) 2018-2023 Boise State University.
3+
# Copyright (C) 2023-2026 Drexel University.
4+
# Licensed under the MIT license, see LICENSE.md for details.
5+
# SPDX-License-Identifier: MIT
6+
7+
from pathlib import Path
8+
from shutil import copytree
9+
10+
import numpy as np
11+
12+
from pytest import mark, raises
13+
14+
from lenskit.data import Dataset, load_movielens, load_movielens_df, load_ms_web
15+
from lenskit.testing import ml_test_dir
16+
17+
MSWEB_TRAIN = Path("data/anonymous-msweb.data.gz")
18+
MSWEB_TEST = Path("data/anonymous-msweb.test.gz")
19+
20+
21+
@mark.skipif(not MSWEB_TRAIN.exists(), reason="msweb data not present")
22+
@mark.realdata
23+
def test_msweb_train():
24+
ds = load_ms_web(MSWEB_TRAIN)
25+
assert 32000 < ds.entities("session").count() < 33000
26+
assert 250 < ds.item_count < 300
27+
28+
29+
@mark.skipif(not MSWEB_TEST.exists(), reason="msweb data not present")
30+
@mark.realdata
31+
def test_msweb_test():
32+
ds = load_ms_web(MSWEB_TEST, "collection")
33+
assert len(ds) >= 500

0 commit comments

Comments
 (0)