-
Notifications
You must be signed in to change notification settings - Fork 373
Refactor CompositeSpec tests #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for this! Let's have a look at the failed tests. |
Yes, looking at this right now. Unfortunately, I wasn't able to make suggested pre-commit linter work, but I ran some linters separately, and that should fix most issues. |
Fix mock envs dtype casting
Device check for bounded space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost good to go!
Can you add a delitem method that points to del_, I don't think it exists yet
test/test_tensor_spec.py
Outdated
def test_setitem_matches_device(self, is_complete, device, dtype): | ||
ts = self._composite_spec(is_complete, device, dtype) | ||
|
||
bad_value, good_value = Mock(), Mock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea of using Mock though I see two caveats:
At one point we might check that specs are or type TensorSpec, does mock works in that case? (Ie does isinstance(mock, type) always true for all types?)
Second we rely on pytest for our tests and I'm not sure if we want to mix unittest and pytest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points, I'll change this.
test/test_tensor_spec.py
Outdated
ts = self._composite_spec(is_complete, device, dtype) | ||
assert "obs" in ts.keys() | ||
assert "act" in ts.keys() | ||
ts.del_("obs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try with
del ts["obs"]
Too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Though I'm curious why we need del_
then, can we simply rename it to __delitem__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure! If tests pass i'm ok with it :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Staggering! Thanks a lot
#220