migration from ha-cantegrill repo
This commit is contained in:
56
unit_tests/test_attributes.yaml
Normal file
56
unit_tests/test_attributes.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.with_state_and_attribute: 'SomeRandomState'
|
||||
sensor.with_state_and_attribute.off: 'off'
|
||||
sensor.with_state_and_attribute.on: 'on'
|
||||
sensor.with_state_and_attribute.f127: 127
|
||||
sensor.with_only_attribute.on: 'on'
|
||||
sensor.None: #None
|
||||
|
||||
constants:
|
||||
self: sensor.with_state_and_attribute
|
||||
pi: 3.14
|
||||
|
||||
tests:
|
||||
test_1:
|
||||
expected_result: Succeeded
|
||||
conditions: sensor.with_state_and_attribute.on
|
||||
|
||||
test_2:
|
||||
expected_result: Succeeded
|
||||
#TODO: find a way to make it work without parenthesis
|
||||
#conditions: (sensor.with_state_and_attribute.on and binary_sensor.on) == not binary_sensor.false
|
||||
conditions: (sensor.with_state_and_attribute.on and binary_sensor.on) == (not binary_sensor.false)
|
||||
|
||||
test_3:
|
||||
expected_result: Succeeded
|
||||
conditions: sensor.with_state_and_attribute.f127 < sensor.int170
|
||||
|
||||
test_4:
|
||||
expected_result: ParsingException
|
||||
conditions: sensor.with_only_attribute.on != binary_sensor.on
|
||||
|
||||
test_5:
|
||||
expected_result: Succeeded
|
||||
#TODO: find a way to make it work without parenthesis
|
||||
#conditions: (self.on and binary_sensor.on) == not binary_sensor.false
|
||||
conditions: (self.on and binary_sensor.on) == (not binary_sensor.false)
|
||||
|
||||
test_6:
|
||||
expected_result: Succeeded
|
||||
conditions: self.f127 < sensor.int170
|
||||
|
||||
test_7:
|
||||
expected_result: ParsingException
|
||||
conditions: pi.on != binary_sensor.on
|
||||
Reference in New Issue
Block a user