File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ Unit-tests for TiledEnv class
3+ """
4+ import unittest
5+ import pytest
6+ from src .spaces .tiled_environment import TiledEnv , TiledEnvConfig
7+ from src .exceptions .exceptions import InvalidParamValue
8+
9+
10+ class TestTiledEnv (unittest .TestCase ):
11+
12+ def test_constructor_raises_zero_max_size (self ):
13+ config = TiledEnvConfig ()
14+ config .env = None
15+ config .max_size = 0
16+ config .tiling_dim = 2
17+ config .num_tilings = 5
18+ with pytest .raises (InvalidParamValue ) as e :
19+ env = TiledEnv (config )
20+
21+ def test_constructor_raises_invalid_max_size (self ):
22+ config = TiledEnvConfig ()
23+ config .env = None
24+ config .max_size = 1
25+ config .tiling_dim = 2
26+ config .num_tilings = 5
27+ with pytest .raises (InvalidParamValue ) as e :
28+ env = TiledEnv (config )
29+
30+ def test_empty_column_scales (self ):
31+ config = TiledEnvConfig ()
32+ config .env = None
33+ config .max_size = 4096
34+ config .tiling_dim = 2
35+ config .num_tilings = 5
36+ config .columns_scales = {}
37+ with pytest .raises (InvalidParamValue ) as e :
38+ env = TiledEnv (config )
39+
40+
41+
42+ if __name__ == '__main__' :
43+ unittest .main ()
You can’t perform that action at this time.
0 commit comments