migration from ha-cantegrill repo
This commit is contained in:
56
unit_tests/test_ternary_operator.yaml
Normal file
56
unit_tests/test_ternary_operator.yaml
Normal file
@@ -0,0 +1,56 @@
|
||||
fake_entities:
|
||||
binary_sensor.true: True
|
||||
binary_sensor.false: False
|
||||
binary_sensor.off: 'off'
|
||||
binary_sensor.on: 'on'
|
||||
sensor.int17: 17
|
||||
sensor.int170: 170
|
||||
sensor.int200: 200
|
||||
sensor.int3: 3
|
||||
sensor.float10: 10.0
|
||||
sensor.float5: 5.0
|
||||
sensor.strNuit: 'Nuit'
|
||||
sensor.strHome: 'home'
|
||||
sensor.none:
|
||||
|
||||
tests:
|
||||
test_1:
|
||||
expected_result: Succeeded
|
||||
conditions: "(binary_sensor.on ? 10 : 0) > sensor.int3"
|
||||
|
||||
test_2:
|
||||
expected_result: Succeeded
|
||||
conditions: "(binary_sensor.on ? sensor.float10 : 0) > sensor.int3"
|
||||
|
||||
test_3:
|
||||
expected_result: Failed
|
||||
conditions: "binary_sensor.off ? (binary_sensor.on or binary_sensor.off) : binary_sensor.off"
|
||||
|
||||
test_4:
|
||||
expected_result: Failed
|
||||
conditions: "binary_sensor.on ? binary_sensor.on and binary_sensor.off : binary_sensor.on"
|
||||
|
||||
test_5:
|
||||
expected_result: Succeeded
|
||||
conditions: "((binary_sensor.on or binary_sensor.false) ? 5 : 1) > sensor.int3"
|
||||
|
||||
test_6:
|
||||
expected_result: Failed
|
||||
conditions: "((binary_sensor.on and binary_sensor.false) ? 5 : 1) > sensor.int3"
|
||||
|
||||
test_7:
|
||||
expected_result: Succeeded
|
||||
conditions: "(binary_sensor.on ? sensor.float10 : 0) > sensor.int3"
|
||||
|
||||
test_none_ternary:
|
||||
expected_result: Failed
|
||||
conditions: "sensor.none != None ? sensor.none > 75 : False"
|
||||
|
||||
# test_15:
|
||||
# expected_result: Succeeded
|
||||
# conditions: "(binary_sensor.off ? (binary_sensor.on or binary_sensor.off) : (binary_sensor.off ? sensor.int3 : sensor.int17)) > sensor.int3"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user