Exemplo n.º 1
0
def test_SchoutenTensor_parent_metric_property_and_ValueError():
    mt = anti_de_sitter_metric()
    St = SchoutenTensor.from_metric(mt)
    assert St.parent_metric == St._parent_metric and St.parent_metric == mt
    # ValueError test part
    try:
        St2 = SchoutenTensor(St.tensor(), St.syms, config="uuu")
        assert False
    except ValueError:
        assert True
Exemplo n.º 2
0
def test_SchoutenTensor_config_change():
    metric = schwarzschild_metric()
    t1 = SchoutenTensor.from_metric(metric)
    t2 = t1.change_config("ul")
    t3 = t2.change_config("ll")
    assert t1.config == "ll" and t3.config == "ll"
    compare = sympy.Array(np.zeros((4, 4), dtype=int))
    testarr = simplify_sympy_array(t1.tensor() - t3.tensor())
    assert testarr == compare
Exemplo n.º 3
0
def test_Schouten_dim2():
    list_metric = np.zeros((2, 2), dtype=int).tolist()
    symbolstr = "t r"
    syms = sympy.symbols(symbolstr)
    metric = MetricTensor(list_metric, syms)
    try:
        obj = SchoutenTensor.from_metric(metric)
        assert False
    except ValueError:
        assert True
Exemplo n.º 4
0
def test_SchoutenTensor_with_arbritary_config():
    sch = schwarzschild_metric()
    ch = SchoutenTensor.from_metric(sch)
    assert ch.parent_metric == ch._parent_metric
    # test change_config, should raise ValueError
    ch._parent_metric = None
    try:
        ch_new = ch.change_config("lll")
        assert False
    except Exception:
        return True