Exemplo n.º 1
0
Arquivo: tests.py Projeto: ahd985/ssv
    def test_validate_array_str(self, arr_str):
        # Cycle through allowable min_dim values
        for i in range(1, len(arr_str.shape) + 1):
            validate_array(arr_str, 'str', i, len(arr_str.shape), arr_str.shape[0])

        # Check unbounded dims
        validate_array(arr_str, 'str', None)
Exemplo n.º 2
0
Arquivo: tests.py Projeto: ahd985/ssv
    def test_validate_array_num(self, arr_num):
        # Cycle through allowable min_dim values
        for i in range(1, len(arr_num.shape)+1):
            validate_array(arr_num, 'float', i, len(arr_num.shape), arr_num.shape[0])

        # Check unbounded dims
        validate_array(arr_num, 'float', None)
Exemplo n.º 3
0
    def test_validate_array_str(self, arr_str):
        # Cycle through allowable min_dim values
        for i in range(1, len(arr_str.shape) + 1):
            validate_array(arr_str, 'str', i, len(arr_str.shape),
                           arr_str.shape[0])

        # Check unbounded dims
        validate_array(arr_str, 'str', None)
Exemplo n.º 4
0
    def test_validate_array_num(self, arr_num):
        # Cycle through allowable min_dim values
        for i in range(1, len(arr_num.shape) + 1):
            validate_array(arr_num, 'float', i, len(arr_num.shape),
                           arr_num.shape[0])

        # Check unbounded dims
        validate_array(arr_num, 'float', None)
Exemplo n.º 5
0
Arquivo: tests.py Projeto: ahd985/ssv
 def test_validate_array_fail(self, arr_num):
     # Fail on min_dim being too high
     with pytest.raises(ValueError):
         validate_array(arr_num, 'float', len(arr_num.shape)+1, len(arr_num.shape), arr_num.shape[0])
     # Fail on max_dim being too low
     with pytest.raises(ValueError):
         validate_array(arr_num, 'float', 0, len(arr_num.shape)-1, arr_num.shape[0])
     # Fail dim 0 len + 1
     with pytest.raises(ValueError):
         validate_array(arr_num, 'float', 0, len(arr_num.shape) - 1, arr_num.shape[0]+1)
     # Fail dim 0 len - 1
     with pytest.raises(ValueError):
         validate_array(arr_num, 'float', 0, len(arr_num.shape) - 1, arr_num.shape[0]-1)
Exemplo n.º 6
0
 def test_validate_array_fail(self, arr_num):
     # Fail on min_dim being too high
     with pytest.raises(ValueError):
         validate_array(arr_num, 'float',
                        len(arr_num.shape) + 1, len(arr_num.shape),
                        arr_num.shape[0])
     # Fail on max_dim being too low
     with pytest.raises(ValueError):
         validate_array(arr_num, 'float', 0,
                        len(arr_num.shape) - 1, arr_num.shape[0])
     # Fail dim 0 len + 1
     with pytest.raises(ValueError):
         validate_array(arr_num, 'float', 0,
                        len(arr_num.shape) - 1, arr_num.shape[0] + 1)
     # Fail dim 0 len - 1
     with pytest.raises(ValueError):
         validate_array(arr_num, 'float', 0,
                        len(arr_num.shape) - 1, arr_num.shape[0] - 1)
Exemplo n.º 7
0
 def test_validate_array_num_bad_type(self):
     arr = [[1, 2, 3, 'x'], ['z', 0, 3, 2]]
     with pytest.raises(ValueError):
         validate_array(arr, 'float', None)
Exemplo n.º 8
0
 def test_validate_array_dim_mismatch(self):
     arr = [[1, 2, 3, 0], [0, 0, 3]]
     with pytest.raises(ValueError):
         validate_array(arr, 'float', None)
Exemplo n.º 9
0
Arquivo: tests.py Projeto: ahd985/ssv
 def test_validate_array_num_bad_type(self):
     arr = [[1, 2, 3, 'x'], ['z', 0, 3, 2]]
     with pytest.raises(ValueError):
         validate_array(arr, 'float', None)
Exemplo n.º 10
0
Arquivo: tests.py Projeto: ahd985/ssv
 def test_validate_array_dim_mismatch(self):
     arr = [[1, 2, 3, 0], [0, 0, 3]]
     with pytest.raises(ValueError):
         validate_array(arr, 'float', None)