Skip to content

Add unit tests of lookup functionality and minor lookup refactor#80

Merged
RNKuhns merged 45 commits into
sktime:mainfrom
RNKuhns:refactor_lkp
Dec 31, 2022
Merged

Add unit tests of lookup functionality and minor lookup refactor#80
RNKuhns merged 45 commits into
sktime:mainfrom
RNKuhns:refactor_lkp

Conversation

@RNKuhns
Copy link
Copy Markdown
Contributor

@RNKuhns RNKuhns commented Nov 23, 2022

Reference Issues/PRs

Fixes #70, improves test coverage (fixes #66), fixes bugs, improves code consistency and docstrings (fixes #35 ).

What does this implement/fix? Explain your changes.

This adds unit tests for the lookup functionality in skbase. Also does minor refactor and docstring improvements as things are discovered in testing process.

Does your contribution introduce a new dependency? If yes, which one?

@RNKuhns RNKuhns requested a review from fkiraly November 23, 2022 22:58
@RNKuhns RNKuhns marked this pull request as draft November 23, 2022 22:58
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 3, 2022

Codecov Report

Merging #80 (6209f8a) into main (50e6629) will increase coverage by 16.27%.
The diff coverage is 99.04%.

@@             Coverage Diff             @@
##             main      #80       +/-   ##
===========================================
+ Coverage   61.55%   77.83%   +16.27%     
===========================================
  Files          23       23               
  Lines        1514     1877      +363     
===========================================
+ Hits          932     1461      +529     
+ Misses        582      416      -166     
Impacted Files Coverage Δ
skbase/testing/test_all_objects.py 79.04% <25.00%> (-0.22%) ⬇️
skbase/lookup/_lookup.py 95.48% <98.03%> (+51.64%) ⬆️
skbase/lookup/tests/__init__.py 100.00% <100.00%> (ø)
skbase/lookup/tests/test_lookup.py 100.00% <100.00%> (ø)
skbase/testing/utils/__init__.py 100.00% <100.00%> (ø)
skbase/tests/mock_package/test_mock_package.py
skbase/testing/utils/tests/test_deep_equals.py 100.00% <0.00%> (+8.33%) ⬆️
skbase/testing/utils/deep_equals.py 63.88% <0.00%> (+13.19%) ⬆️
skbase/validate/_types.py 62.50% <0.00%> (+16.66%) ⬆️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment thread skbase/lookup/tests/test_lookup.py Fixed
@fkiraly
Copy link
Copy Markdown
Contributor

fkiraly commented Dec 25, 2022

What exactly is stuck here, do we know that? Can I help?

@RNKuhns
Copy link
Copy Markdown
Contributor Author

RNKuhns commented Dec 26, 2022

What exactly is stuck here, do we know that? Can I help?

@fkiraly I haven't investigated the POSIX paths not having starts with attribute in detail yet. Those aren't occurring locally. I'm checking now if the issue is with the validation of the returned results in the test or call to the actual _walk function having some sort of bug. Will let you know.

Other errors are just things popping up as I am slowly adding tests (I elected to keep adding tests and let the failing test hang out till I was finished). Expect to finish up the test adding today or tomorrow.

Comment thread skbase/lookup/_lookup.py
Comment thread skbase/lookup/_lookup.py
Comment thread skbase/lookup/_lookup.py Outdated
Comment thread skbase/lookup/_lookup.py
Comment thread skbase/tests/conftest.py Outdated
Comment thread skbase/lookup/tests/__init__.py
Comment thread skbase/tests/conftest.py Outdated
Comment thread skbase/tests/conftest.py Outdated
Comment thread skbase/mock_package/mock_package.py Outdated
Comment thread skbase/lookup/tests/test_lookup.py Outdated
Comment thread skbase/lookup/tests/test_lookup.py Outdated
Comment thread skbase/lookup/tests/test_lookup.py
Copy link
Copy Markdown
Contributor

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

  • tests make sense overall. Impressed that we tests internal utilities as well as the full function.
  • tests seem to cover important arguments of all_objects
  • left some minor/non-blocking comments overall

My main blocking comment or question:

  • overall, I don't see a test that compares retrieved objects with a hard-coded set of expected objects from the mock package, e.g., in test_all_objects_returns_expected_types. Maybe I'm just blind/confused
  • test_all_object_class_lookup, should this not test the content of the return, objs, being the right objects (given the mock package)?

@RNKuhns
Copy link
Copy Markdown
Contributor Author

RNKuhns commented Dec 28, 2022

Great!

  • tests make sense overall. Impressed that we tests internal utilities as well as the full function.
  • tests seem to cover important arguments of all_objects
  • left some minor/non-blocking comments overall

My main blocking comment or question:

  • overall, I don't see a test that compares retrieved objects with a hard-coded set of expected objects from the mock package, e.g., in test_all_objects_returns_expected_types. Maybe I'm just blind/confused
  • test_all_object_class_lookup, should this not test the content of the return, objs, being the right objects (given the mock package)?

That's a good point. I'd been avoiding a specific comparison and instead verifying things based on whether the return types, counts, etc make sense in light of the filters being applied on the returned metadata/objects. I'll push a test of the specific output as well. I'll make that separate from the test_all_objects_returns_expected_types and test_all_object_class_lookup, which are, respectively, focused on whether all_objects is returning the right type of results (not that the exact results are correct and the usage of class_lookup param in all_objects.

Comment thread skbase/tests/conftest.py


# Fixture class for testing tag system
class Parent(BaseObject):

Check warning

Code scanning / CodeQL

`__eq__` not overridden when adding attributes

The class 'Parent' does not override ['__eq__'](1), but adds the new attribute [a](2). The class 'Parent' does not override ['__eq__'](1), but adds the new attribute [b](3). The class 'Parent' does not override ['__eq__'](1), but adds the new attribute [c](4).
Copy link
Copy Markdown
Contributor

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now.

Checked:

  • reference in TestAllObjects
  • mock package looks good
  • lookup also uses mock package

All comments addressed, hence.

@RNKuhns RNKuhns merged commit 669451a into sktime:main Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rename ignore_modules to modules_to_ignore? Expand Test Coverage of Lookup Interface [BUG] all_objects docstring renders strangely

4 participants