def test_Params(): p = util.Params([ util.Param(0, "foo", 1.2, 3.4, None, False, False, True, True, False, 42, None), util.Param(1, "bar", 3.4, 4.5, None, False, False, True, True, False, 42, None), ]) assert repr(p) == repr((p[0], p[1])) assert p[0].number == 0 assert p[1].number == 1 assert p["foo"].number == 0 assert p["bar"].number == 1
def test_Param(): values = 3, "foo", 1.2, 3.4, None, False, False, True, True, False, 42, None p = util.Param(*values) with PrintAssert("Param(...)") as pr: p._repr_pretty_(pr, True) with PrintAssert(tx.params([p])) as pr: p._repr_pretty_(pr, False)
def test_Params(): p = util.Params([ util.Param(3, "foo", 1.2, 3.4, None, False, False, True, True, False, 42, None) ]) with PrintAssert("Params(...)") as pr: p._repr_pretty_(pr, True) with PrintAssert(tx.params(p)) as pr: p._repr_pretty_(pr, False)
def test_Param(): values = 3, "foo", 1.2, 3.4, None, False, False, True, True, False, 42, None p = util.Param(*values) assert p.number == 3 assert p.name == "foo" assert p.value == 1.2 assert p.error == 3.4 assert p.merror is None assert p.is_const == False assert p.is_fixed == False assert p.has_limits == True assert p.has_lower_limit is True assert p.has_upper_limit is False assert p.lower_limit == 42 assert p.upper_limit is None assert repr(p) == ( "Param(number=3, name='foo', value=1.2, error=3.4, merror=None, " "is_const=False, is_fixed=False, has_limits=True, has_lower_limit=True, " "has_upper_limit=False, lower_limit=42, upper_limit=None)")
def test_Param(): keys = "number name value error is_const is_fixed has_limits has_lower_limit has_upper_limit lower_limit upper_limit".split( ) # noqa: E501 values = 3, "foo", 1.2, 3.4, False, False, True, True, False, 42, None p = util.Param(*values) assert p.has_lower_limit is True assert p.has_upper_limit is False assert p["has_lower_limit"] is True assert p["lower_limit"] == 42 assert p["upper_limit"] is None assert "upper_limit" in p assert "foo" not in p assert list(p) == keys assert p.keys() == tuple(keys) assert p.values() == values assert p.items() == tuple((k, v) for k, v in zip(keys, values)) assert ( str(p) == "Param(number=3, name='foo', value=1.2, error=3.4, is_const=False, is_fixed=False, has_limits=True, has_lower_limit=True, has_upper_limit=False, lower_limit=42, upper_limit=None)" # noqa: E501 )