Ejemplo n.º 1
0
def test_set_dimension_preference_fails_if_scalar():
    """Test that the dimension_preference property fails with scalar."""
    m = StochasticCollocation()
    pt = 42
    m.dimension_preference = pt
Ejemplo n.º 2
0
def test_dimension_preference_sets_quadrature_order1():
    """Test that dimension_preference sets quadrature order."""
    m = StochasticCollocation()
    m.dimension_preference = [3, 4, 5]
    assert_equal(m.quadrature_order, max(m.dimension_preference))
Ejemplo n.º 3
0
def test_set_quadrature_order_fails_if_float():
    """Test that the quadrature_order property fails with a float."""
    m = StochasticCollocation()
    quadrature_order = 42.0
    m.quadrature_order = quadrature_order
Ejemplo n.º 4
0
def test_set_dimension_preference():
    """Test setting the dimension_preference property."""
    m = StochasticCollocation()
    for items in [[0, 1], (0, 1)]:
        m.dimension_preference = items
        assert_equal(m.dimension_preference, items)
Ejemplo n.º 5
0
def test_set_basis_polynomial_family():
    """Test setting the basis_polynomial_family property."""
    m = StochasticCollocation()
    p = "piecewise"
    m.basis_polynomial_family = p
    assert_equal(m.basis_polynomial_family, p)
Ejemplo n.º 6
0
def test_set_quadrature_order():
    """Test setting the quadrature_order property."""
    m = StochasticCollocation()
    quadrature_order = 42
    m.quadrature_order = quadrature_order
    assert_equal(m.quadrature_order, quadrature_order)
Ejemplo n.º 7
0
def test_init_no_params():
    """Test creating an instance with no parameters."""
    x1 = StochasticCollocation()
    assert_is_instance(x1, StochasticCollocation)
Ejemplo n.º 8
0
def test_str_length_with_options():
    """Test the length of __str__ with optional props set."""
    m = StochasticCollocation(dimension_preference=(1, 2), nested=True)
    s = str(m)
    n_lines = len(s.splitlines())
    assert_equal(n_lines, 9)
Ejemplo n.º 9
0
def test_set_nested_fails_if_float():
    """Test that the nested property fails with a float."""
    m = StochasticCollocation()
    nested = 42.0
    m.nested = nested
Ejemplo n.º 10
0
def test_set_nested():
    """Test setting the nested property."""
    m = StochasticCollocation()
    nested = True
    m.nested = nested
    assert_equal(m.nested, nested)
Ejemplo n.º 11
0
def setup_module():
    """Called before any tests are performed."""
    print("\n*** " + __name__)
    global x
    x = StochasticCollocation()