Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
37150eb
ENH: add regression test for HTML repr of meta-objects (fixes #163)
arnavk23 Nov 19, 2025
b0ce58c
ENH: add test for all_objects tag filtering (regression for #161/#162)
arnavk23 Nov 19, 2025
b06f1fb
Delete skbase/base/_pretty_printing/tests/test_object_html_repr.py
arnavk23 Nov 19, 2025
b5c9c06
STYLE: wrap long docstring to satisfy flake8 E501
arnavk23 Nov 19, 2025
72a688c
tests(lookup): restrict package_name to skbase.tests to reduce scan s…
arnavk23 Nov 21, 2025
ef2a3de
tests(lookup): use dedicated mock_package fixtures; add fixtures and …
arnavk23 Nov 22, 2025
9dd4cd9
tests(mock_package): add public module, private module, and subpackag…
arnavk23 Nov 22, 2025
15b7935
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 22, 2025
d670fa2
style(tests): fix indentation (replace tabs with spaces) in mock_pack…
arnavk23 Nov 22, 2025
95db0d0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 22, 2025
08054cb
tests(mock_package): remove old files renamed to test_* counterparts
arnavk23 Nov 22, 2025
cfc4d14
correcting test file names
arnavk23 Nov 22, 2025
6e00981
fixing tags
arnavk23 Nov 28, 2025
0174af9
Fix flake8 B043 error: use variable for delattr attribute name
arnavk23 Dec 15, 2025
cea639d
Add arnavk23 (Arnav Kapoor) to contributors list
arnavk23 Dec 15, 2025
d36b14a
actual representation against the expected representation
arnavk23 Nov 23, 2025
a3f25fe
Fix test_get_package_metadata: remove imported classes from __all__ i…
arnavk23 Dec 15, 2025
5467010
Fix flake8 F401: add noqa comments for re-exported classes in mock_pa…
arnavk23 Dec 15, 2025
3a45ea6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 15, 2025
0d901dc
Merge branch 'main' into fix/issue-114-restrict-lookup-tests
arnavk23 Dec 21, 2025
31fcf6d
Merge branch 'main' into pr/476
fkiraly Jan 3, 2026
fac3d04
Update test_base.py
fkiraly Jan 3, 2026
20a572b
Merge branch 'main' into fix/issue-114-restrict-lookup-tests
arnavk23 Jan 4, 2026
a8946f8
Merge branch 'main' into fix/issue-114-restrict-lookup-tests
arnavk23 Jan 4, 2026
a1a97cb
Merge branch 'main' into fix/issue-114-restrict-lookup-tests
arnavk23 Jan 23, 2026
36e61c3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 23, 2026
b088695
Merge branch 'main' into fix/issue-114-restrict-lookup-tests
arnavk23 Jan 27, 2026
c86f4e4
removal of tests that are not relevant to the lookup tests, and to re…
arnavk23 Feb 14, 2026
3b74e86
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 14, 2026
46e0a8b
flake8
arnavk23 Feb 14, 2026
dc489fd
Merge branch 'main' into fix/issue-114-restrict-lookup-tests
arnavk23 Mar 5, 2026
e3e889e
Update test_lookup.py
arnavk23 Mar 6, 2026
acc90cd
Update .all-contributorsrc
arnavk23 Mar 6, 2026
188b76a
adding changes
arnavk23 Mar 6, 2026
e0cab6c
Merge branch 'main' into pr/476
fkiraly Apr 19, 2026
bd77634
added private class and function to mock package and added tests for …
arnavk23 Apr 19, 2026
b675afa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 19, 2026
69d395a
pre-commit
arnavk23 Apr 19, 2026
7761319
Merge branch 'fix/issue-114-restrict-lookup-tests' of https://www.git…
arnavk23 Apr 19, 2026
81bd3f9
Merge branch 'main' into fix/issue-114-restrict-lookup-tests
arnavk23 Apr 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@
"code",
"test"
]
},
{
"login": "arnavk23",
"name": "Arnav Kapoor",
"avatar_url": "https://avatars.githubusercontent.com/u/arnavk23?v=4",
"profile": "https://github.com/arnavk23",
"contributions": [
"code",
"test"
]
}
],
"projectName": "skbase",
Expand Down
18 changes: 9 additions & 9 deletions skbase/lookup/tests/test_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
SKBASE_PUBLIC_CLASSES_BY_MODULE,
SKBASE_PUBLIC_FUNCTIONS_BY_MODULE,
SKBASE_PUBLIC_MODULES,
ClassWithABTrue,
Parent,
)
from skbase.tests.mock_package.test_mock_package import (
from skbase.tests.mock_package import (
MOCK_PACKAGE_OBJECTS,
ClassWithABTrue,
CompositionDummy,
NotABaseObject,
Parent,
)

__author__: List[str] = ["RNKuhns", "fkiraly"]
Expand Down Expand Up @@ -1033,7 +1033,7 @@ def test_all_objects_class_filter(class_filter):
"""Test all_objects filters by class type as expected."""
# Results applying filter
objs = all_objects(
package_name="skbase",
package_name="skbase.tests.mock_package",
return_names=True,
as_dataframe=True,
return_tags=None,
Expand All @@ -1047,7 +1047,7 @@ def test_all_objects_class_filter(class_filter):

# Results without filter
objs = all_objects(
package_name="skbase",
package_name="skbase.tests.mock_package",
return_names=True,
as_dataframe=True,
return_tags=None,
Expand All @@ -1073,7 +1073,7 @@ def test_all_object_tag_filter(tag_filter):
"""Test all_objects filters by tag as expected."""
# Results applying filter
objs = all_objects(
package_name="skbase",
package_name="skbase.tests.mock_package",
return_names=True,
as_dataframe=True,
return_tags=None,
Expand All @@ -1087,7 +1087,7 @@ def test_all_object_tag_filter(tag_filter):

# Results without filter
objs = all_objects(
package_name="skbase",
package_name="skbase.tests.mock_package",
return_names=True,
as_dataframe=True,
return_tags=None,
Expand Down Expand Up @@ -1148,7 +1148,7 @@ def test_all_object_class_lookup(class_lookup, class_filter):
"""Test all_objects class_lookup parameter works as expected.."""
# Results applying filter
objs = all_objects(
package_name="skbase",
package_name="skbase.tests.mock_package",
return_names=True,
as_dataframe=True,
return_tags=None,
Expand All @@ -1171,7 +1171,7 @@ def test_all_object_class_lookup_invalid_object_types_raises(
# Results applying filter
with pytest.raises(ValueError):
all_objects(
package_name="skbase",
package_name="skbase.tests.mock_package",
return_names=True,
as_dataframe=True,
return_tags=None,
Expand Down
2 changes: 1 addition & 1 deletion skbase/testing/test_all_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ def test_object_tags(self, object_class):
assert isinstance(tags, dict), msg
assert len(tags) > 0, f"_tags dict of class {object_class} is empty"
if self.valid_tags is None:
invalid_tags = tags
invalid_tags = []
else:
invalid_tags = [
tag for tag in tags.keys() if tag not in self.valid_tags
Expand Down
13 changes: 13 additions & 0 deletions skbase/tests/mock_package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,17 @@

from typing import List

from .test_fixtures import Child # noqa: F401
from .test_fixtures import ClassWithABTrue # noqa: F401
from .test_fixtures import Parent # noqa: F401
from .test_mock_package import MOCK_PACKAGE_OBJECTS # noqa: F401
from .test_mock_package import AnotherClass # noqa: F401
from .test_mock_package import CompositionDummy # noqa: F401
from .test_mock_package import InheritsFromBaseObject # noqa: F401
from .test_mock_package import NotABaseObject # noqa: F401

__all__: List[str] = [
"MOCK_PACKAGE_OBJECTS",
]

__author__: List[str] = ["fkiraly", "RNKuhns"]
3 changes: 3 additions & 0 deletions skbase/tests/mock_package/subpkg/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Subpackage in mock package to test recursive walking."""

__all__ = ["test_module_b"]
10 changes: 10 additions & 0 deletions skbase/tests/mock_package/subpkg/test_module_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
"""Module inside subpackage to test recursive discovery."""


def subpkg_fn():
"""Return the string "ok" to indicate functionality."""
return "ok"


__all__ = ["subpkg_fn"]
47 changes: 47 additions & 0 deletions skbase/tests/mock_package/test_fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
"""Additional fixture classes for the mock package used in lookup tests."""

from typing import List

from skbase.base import BaseObject

__author__: List[str] = ["fkiraly", "RNKuhns"]


class Parent(BaseObject):

Check warning

Code scanning / CodeQL

`__eq__` not overridden when adding attributes Warning test

The class 'Parent' does not override
'__eq__'
, but adds the new attribute
a
.
The class 'Parent' does not override
'__eq__'
, but adds the new attribute
b
.
The class 'Parent' does not override
'__eq__'
, but adds the new attribute
c
.
"""Parent class to test tag inheritance and class filters."""

_tags = {"A": "1", "B": 2, "C": 1234, "3": "D"}

def __init__(self, a="something", b=7, c=None):
"""Initialize the fixture with simple attributes."""
self.a = a
self.b = b
self.c = c
super().__init__()

def some_method(self):
"""Placeholder method used in tests."""
pass


class Child(Parent):
"""Child class that overrides some tags."""

_tags = {"A": 42, "3": "E"}
__author__ = ["fkiraly", "RNKuhns"]

def some_method(self):
"""Child placeholder method used in tests."""
pass


class ClassWithABTrue(Parent):
"""Child class that sets A and B tags to True."""

_tags = {"A": True, "B": True}
__author__ = ["fkiraly", "RNKuhns"]

def some_method(self):
"""Placeholder method used in tests."""
pass
5 changes: 5 additions & 0 deletions skbase/tests/mock_package/test_mock_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from skbase.base import BaseObject

from .test_fixtures import Child, ClassWithABTrue, Parent

__all__: List[str] = [
"CompositionDummy",
"InheritsFromBaseObject",
Expand Down Expand Up @@ -72,4 +74,7 @@ class _NonPublicClass(BaseObject):
CompositionDummy,
InheritsFromBaseObject,
_NonPublicClass,
Parent,
Child,
ClassWithABTrue,
]
26 changes: 26 additions & 0 deletions skbase/tests/mock_package/test_module_public.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""Public module in mock package with decorated and plain functions."""

from functools import wraps


def simple_function(x):
"""Double the given input and return the result."""
return x * 2


def my_decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)

return wrapper


@my_decorator
def decorated_function(y):
"""Increment the given input by one and return the result."""
return y + 1


__all__ = ["simple_function", "decorated_function"]
18 changes: 18 additions & 0 deletions skbase/tests/mock_package/test_private_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
"""Non-public module in mock package; contains a non-public BaseObject subclass.

This module's class name begins with an underscore and should be ignored by
`all_objects` when `exclude_non_public_items` is True.
"""

from skbase.base import BaseObject


class _PrivateThing(BaseObject):
"""A non-public BaseObject subclass that should be ignored by discovery."""

def __init__(self):
super().__init__()


__all__ = ["_PrivateThing"]
29 changes: 29 additions & 0 deletions skbase/tests/test_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,32 @@ def test_all_objects_returns_class_name_for_alias(tmp_path, monkeypatch):

sys.modules.pop(f"{pkg_name}.module", None)
sys.modules.pop(pkg_name, None)


def test_all_objects_filter_tags_returns_matches(tmp_path, monkeypatch):
"""Test that all_objects honors the filter_tags argument.

Ensure the function returns matching classes when a tag is provided.
"""
pkg_name = "pkg_tag_case"
root = tmp_path / pkg_name
root.mkdir()

(root / "__init__.py").write_text(
Comment thread
arnavk23 marked this conversation as resolved.
Outdated
"from .module import MyClass\n" "__all__ = ['MyClass']\n"
)
(root / "module.py").write_text(
"from skbase.base import BaseObject\n\n"
"class MyClass(BaseObject):\n"
" _tags = {'special_tag': True}\n"
)
monkeypatch.syspath_prepend(str(tmp_path))
importlib.invalidate_caches()

objs = all_objects(package_name=pkg_name, path=str(root), filter_tags="special_tag")
assert len(objs) == 1
name, klass = objs[0]
assert name == klass.__name__ == "MyClass"

sys.modules.pop(f"{pkg_name}.module", None)
sys.modules.pop(pkg_name, None)