-
-
Notifications
You must be signed in to change notification settings - Fork 875
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecated wrapper error in gymnasium.experimental.wrappers (#341)
- Loading branch information
Showing
8 changed files
with
117 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Test suite for import wrappers.""" | ||
|
||
import re | ||
|
||
import pytest | ||
|
||
import gymnasium.experimental.wrappers as wrappers | ||
|
||
|
||
def test_import_wrappers(): | ||
"""Test that all wrappers can be imported.""" | ||
# Test that a deprecated wrapper raises a DeprecatedWrapper | ||
with pytest.raises( | ||
wrappers.DeprecatedWrapper, | ||
match=re.escape("'NormalizeRewardV0' is now deprecated"), | ||
): | ||
getattr(wrappers, "NormalizeRewardV0") | ||
|
||
# Test that an invalid version raises an AttributeError | ||
with pytest.raises( | ||
AttributeError, | ||
match=re.escape( | ||
"module 'gymnasium.experimental.wrappers' has no attribute 'ClipRewardVT', did you mean" | ||
), | ||
): | ||
getattr(wrappers, "ClipRewardVT") | ||
|
||
with pytest.raises( | ||
AttributeError, | ||
match=re.escape( | ||
"module 'gymnasium.experimental.wrappers' has no attribute 'ClipRewardV99', did you mean" | ||
), | ||
): | ||
getattr(wrappers, "ClipRewardV99") | ||
|
||
# Test that an invalid wrapper raises an AttributeError | ||
with pytest.raises( | ||
AttributeError, | ||
match=re.escape( | ||
"module 'gymnasium.experimental.wrappers' has no attribute 'NonexistentWrapper'" | ||
), | ||
): | ||
getattr(wrappers, "NonexistentWrapper") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters