def test_float_operators(params): Parameters.set_parameter_file('file', {'key': 5.5}) p = Parameter('file', 'key') assert p < 6 assert not p <= 5 assert p >= 5 assert p > 4
def test_lookup(params): data = {'key1': {'key2': 'value2'}} Parameters.set_parameter_file('file1', data) p = Parameter('file1', 'key1', 'key2') assert p == 'value2' data['key1']['key2'] = 3 assert p == 3
def test_arithmetic(params): Parameters.set_parameter_file('file', {'key': 1}) p = Parameter('file', 'key') assert int(p) == 1 assert p + 1 == 2 assert p - 1 == 0 assert p * 3 == 3 assert p / 2 == 0.5 assert p // 2 == 0 assert p << 1 == 2 assert p >> 1 == 0 assert p | 2 == 3 assert p & 2 == 0
def test_int_operators(params): Parameters.set_parameter_file('file', {'key': 5}) p = Parameter('file', 'key') assert p == 5 assert p != 6 assert p < 6 assert p <= 5 assert p >= 5 assert p > 4 Parameters.set_parameter_file('file', {'key': 15}) assert not p < 6 assert not p <= 5 assert p >= 5 assert p > 4