piphi-runtime-testkit-python 0.3.2__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/PKG-INFO +1 -1
  2. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/pyproject.toml +1 -1
  3. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/behavior_contract.py +8 -2
  4. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_strict_contracts.py +6 -6
  5. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/LICENSE +0 -0
  6. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/README.md +0 -0
  7. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/__init__.py +0 -0
  8. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/assertions.py +0 -0
  9. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/builders.py +0 -0
  10. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/camera.py +0 -0
  11. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/cross_contract.py +0 -0
  12. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/harness.py +0 -0
  13. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/mock_core.py +0 -0
  14. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/pytest_plugin.py +0 -0
  15. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/src/piphi_runtime_testkit_python/waits.py +0 -0
  16. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/__init__.py +0 -0
  17. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_assertions.py +0 -0
  18. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_behavior_contract.py +0 -0
  19. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_builders.py +0 -0
  20. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_camera.py +0 -0
  21. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_command_contract.py +0 -0
  22. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_fastapi_runtime_example.py +0 -0
  23. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_mock_core.py +0 -0
  24. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_mock_core_sequences.py +0 -0
  25. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_pytest_plugin.py +0 -0
  26. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_runtime_config_contract.py +0 -0
  27. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_runtime_flow.py +0 -0
  28. {piphi_runtime_testkit_python-0.3.2 → piphi_runtime_testkit_python-0.3.3}/tests/test_runtime_harness.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: piphi-runtime-testkit-python
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Pytest-first helpers for testing PiPhi runtime integrations
5
5
  Keywords: piphi,pytest,testing,runtime,iot
6
6
  Author-Email: KelvinSan <support@piphi.network>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "piphi-runtime-testkit-python"
3
- version = "0.3.2"
3
+ version = "0.3.3"
4
4
  description = "Pytest-first helpers for testing PiPhi runtime integrations"
5
5
  authors = [
6
6
  { name = "KelvinSan", email = "support@piphi.network" },
@@ -86,8 +86,14 @@ def _runtime_state_samples(
86
86
  for raw_sample in raw_samples:
87
87
  payload = _as_mapping(raw_sample)
88
88
  entries = payload.get("entries")
89
- if isinstance(entries, (list, tuple)):
90
- for entry in entries:
89
+ if isinstance(entries, Mapping):
90
+ entry_values = entries.values()
91
+ elif isinstance(entries, (list, tuple)):
92
+ entry_values = entries
93
+ else:
94
+ entry_values = None
95
+ if entry_values is not None:
96
+ for entry in entry_values:
91
97
  mapped_entry = _as_mapping(entry)
92
98
  append_state(mapped_entry.get("latest_state", mapped_entry))
93
99
  else:
@@ -140,13 +140,13 @@ def test_cross_contract_requires_every_behavior_action_and_trigger_to_be_exercis
140
140
  )
141
141
 
142
142
 
143
- def test_cross_contract_validates_shelly_condition_from_runtime_state() -> None:
143
+ def test_cross_contract_validates_shelly_condition_from_keyed_runtime_state_entries() -> None:
144
144
  capabilities = {"on": {"kind": "sensor", "unit": "bool"}}
145
145
  entities = {
146
146
  "entities": [{
147
147
  "id": "shelly-aabbccddeeff:switch:0",
148
148
  "name": "Switch 0",
149
- "config_id": "shelly-kitchen",
149
+ "config_id": "shelly-test",
150
150
  "device_id": "shelly-aabbccddeeff",
151
151
  "capabilities": ["on"],
152
152
  "available_commands": [],
@@ -164,8 +164,8 @@ def test_cross_contract_validates_shelly_condition_from_runtime_state() -> None:
164
164
  }],
165
165
  }]}
166
166
  state_response = {
167
- "entries": [{
168
- "config_id": "shelly-kitchen",
167
+ "entries": {"shelly-test": {
168
+ "config_id": "shelly-test",
169
169
  "device_id": "shelly-aabbccddeeff",
170
170
  "latest_state": {
171
171
  "connected": True,
@@ -173,10 +173,10 @@ def test_cross_contract_validates_shelly_condition_from_runtime_state() -> None:
173
173
  "key": "switch:0",
174
174
  "type": "switch",
175
175
  "channel": 0,
176
- "on": True,
176
+ "on": False,
177
177
  }],
178
178
  },
179
- }],
179
+ }},
180
180
  }
181
181
 
182
182
  assert_cross_contract(