def test_check_shape(): # Ensure no Error is raised utils._check_shape(np.zeros((3, 4)), 'tvar', (3, 4)) utils._check_shape(np.zeros((3, 4)), 'tvar', (3, 4), (2, )) utils._check_shape(np.zeros((3, 4)), 'tvar', (2, ), (3, 4)) # Ensure Error is raised with pytest.raises(ValueError): utils._check_shape(np.zeros((3, 4)), 'tvar', (2, )) with pytest.raises(ValueError): utils._check_shape(np.zeros((3, 4)), 'tvar', (2, ), (1, 4))
def test_check_shape(): # Ensure no Error is raised utils._check_shape(np.zeros((3, 4)), 'tvar', (3, 4)) utils._check_shape(np.zeros((3, 4)), 'tvar', (3, 4), (2, )) utils._check_shape(np.zeros((3, 4)), 'tvar', (2, ), (3, 4)) # Ensure Error is raised with pytest.raises(ValueError, match='Parameter tvar has wrong shape'): utils._check_shape(np.zeros((3, 4)), 'tvar', (2, )) with pytest.raises(ValueError, match='Parameter tvar has wrong shape'): utils._check_shape(np.zeros((3, 4)), 'tvar', (2, ), (1, 4))