コード例 #1
0
def test_number_property(id):
    actual = number_property({'id': id, 'type': 'number'})
    expected = {id: {
        "exclusiveMaximum": 100,
        "minimum": 0,
        "type": "number"
    }}
    assert actual == expected
コード例 #2
0
def test_number_property_limits(max_value, min_value, integer_only):
    actual = number_property({'id': 'number-question', 'type': 'number', 'limits': {
        'max_value': max_value, 'min_value': min_value, 'integer_only': integer_only
    }})
    expected = {"number-question": {
        "minimum": min_value,
        "type": "integer" if integer_only else "number"
    }}
    expected['number-question'].update({"maximum": max_value} if integer_only else {"exclusiveMaximum": max_value})
    assert actual == expected