Ejemplo n.º 1
0
def test_definition():

    length = Dimension(name="length", symbol="L", length=1)

    assert length.get('length') == 1
    assert length.get('time') is None
    assert length.name == "length"
    assert length.symbol == "L"

    halflength = Dimension(name="length", length=0.5)
    assert halflength.get('length') == sympify("1/2")
Ejemplo n.º 2
0
def test_dict_properties():
    dic = {"length": sympify(1), "time": sympify(2)}
    d = Dimension(dic)

    assert d["length"] == 1
    assert set(d.items()) == set(dic.items())

    assert len(d) == 2

    assert d.get("length") == 1
    assert d.get("mass") is None

    assert ("length" in d) is True
    assert ("mass" in d) is False