pytest-homeassistant-custom-component 0.13.260__py3-none-any.whl → 0.13.262__py3-none-any.whl

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.
@@ -6,6 +6,6 @@ This file is originally from homeassistant/core and modified by pytest-homeassis
6
6
  from typing import TYPE_CHECKING, Final
7
7
  MAJOR_VERSION: Final = 2025
8
8
  MINOR_VERSION: Final = 7
9
- PATCH_VERSION: Final = "0"
9
+ PATCH_VERSION: Final = "2"
10
10
  __short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
11
11
  __version__: Final = f"{__short_version__}.{PATCH_VERSION}"
@@ -160,6 +160,9 @@ class AiohttpClientMocker:
160
160
 
161
161
  for response in self._mocks:
162
162
  if response.match_request(method, url, params):
163
+ # If auth is provided, try to encode it to trigger any encoding errors
164
+ if auth is not None:
165
+ auth.encode()
163
166
  self.mock_calls.append((method, url, data, headers))
164
167
  if response.side_effect:
165
168
  response = await response.side_effect(method, url, data)
@@ -195,7 +198,6 @@ class AiohttpClientMockResponse:
195
198
  if response is None:
196
199
  response = b""
197
200
 
198
- self.charset = "utf-8"
199
201
  self.method = method
200
202
  self._url = url
201
203
  self.status = status
@@ -265,16 +267,32 @@ class AiohttpClientMockResponse:
265
267
  """Return content."""
266
268
  return mock_stream(self.response)
267
269
 
270
+ @property
271
+ def charset(self):
272
+ """Return charset from Content-Type header."""
273
+ if (content_type := self._headers.get("content-type")) is None:
274
+ return None
275
+ content_type = content_type.lower()
276
+ if "charset=" in content_type:
277
+ return content_type.split("charset=")[1].split(";")[0].strip()
278
+ return None
279
+
268
280
  async def read(self):
269
281
  """Return mock response."""
270
282
  return self.response
271
283
 
272
- async def text(self, encoding="utf-8", errors="strict"):
284
+ async def text(self, encoding=None, errors="strict") -> str:
273
285
  """Return mock response as a string."""
286
+ # Match real aiohttp behavior: encoding=None means auto-detect
287
+ if encoding is None:
288
+ encoding = self.charset or "utf-8"
274
289
  return self.response.decode(encoding, errors=errors)
275
290
 
276
- async def json(self, encoding="utf-8", content_type=None, loads=json_loads):
291
+ async def json(self, encoding=None, content_type=None, loads=json_loads) -> Any:
277
292
  """Return mock response as a json."""
293
+ # Match real aiohttp behavior: encoding=None means auto-detect
294
+ if encoding is None:
295
+ encoding = self.charset or "utf-8"
278
296
  return loads(self.response.decode(encoding))
279
297
 
280
298
  def release(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-homeassistant-custom-component
3
- Version: 0.13.260
3
+ Version: 0.13.262
4
4
  Summary: Experimental package to automatically extract test plugins for Home Assistant custom components
5
5
  Home-page: https://github.com/MatthewFlamm/pytest-homeassistant-custom-component
6
6
  Author: Matthew Flamm
@@ -42,7 +42,7 @@ Requires-Dist: requests-mock==1.12.1
42
42
  Requires-Dist: respx==0.22.0
43
43
  Requires-Dist: syrupy==4.9.1
44
44
  Requires-Dist: tqdm==4.67.1
45
- Requires-Dist: homeassistant==2025.7.0
45
+ Requires-Dist: homeassistant==2025.7.2
46
46
  Requires-Dist: SQLAlchemy==2.0.41
47
47
  Requires-Dist: paho-mqtt==2.1.0
48
48
  Requires-Dist: numpy==2.3.0
@@ -60,7 +60,7 @@ Dynamic: summary
60
60
 
61
61
  # pytest-homeassistant-custom-component
62
62
 
63
- ![HA core version](https://img.shields.io/static/v1?label=HA+core+version&message=2025.7.0&labelColor=blue)
63
+ ![HA core version](https://img.shields.io/static/v1?label=HA+core+version&message=2025.7.2&labelColor=blue)
64
64
 
65
65
  [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/MatthewFlamm/pytest-homeassistant-custom-component)
66
66
 
@@ -1,7 +1,7 @@
1
1
  pytest_homeassistant_custom_component/__init__.py,sha256=pUI8j-H-57ncCLnvZSDWZPCtJpvi3ACZqPtH5SbedZA,138
2
2
  pytest_homeassistant_custom_component/asyncio_legacy.py,sha256=UdkV2mKqeS21QX9LSdBYsBRbm2h4JCVVZeesaOLKOAE,3886
3
3
  pytest_homeassistant_custom_component/common.py,sha256=oZPgwYS5SEyeJmcPv-NHmcCXEOQU4mA6OBOmrrcWzCs,65366
4
- pytest_homeassistant_custom_component/const.py,sha256=rLWqNkZHgnHEzyjC3xcVpTYcm8fK_mp9xpThmES7f-0,399
4
+ pytest_homeassistant_custom_component/const.py,sha256=NEGWogFwWzITlXwiEWzDlDABORJsB36P80srYmzEiRs,399
5
5
  pytest_homeassistant_custom_component/ignore_uncaught_exceptions.py,sha256=rilak_dQGMNhDqST1ZzhjZl_qmytFjkcez0vYmLMQ4Q,1601
6
6
  pytest_homeassistant_custom_component/patch_json.py,sha256=hNUeb1yxAr7ONfvX-o_WkI6zhQDCdKl7GglPjkVUiHo,1063
7
7
  pytest_homeassistant_custom_component/patch_recorder.py,sha256=lW8N_3ZIKQ5lsVjRc-ROo7d0egUZcpjquWKqe7iEF94,819
@@ -15,14 +15,14 @@ pytest_homeassistant_custom_component/components/recorder/__init__.py,sha256=ugr
15
15
  pytest_homeassistant_custom_component/components/recorder/common.py,sha256=SoKcNp_rSWMcMUxkbhZ193L67OYBhUbAX1X8IGvIjbA,17943
16
16
  pytest_homeassistant_custom_component/components/recorder/db_schema_0.py,sha256=0mez9slhL-I286dDAxq06UDvWRU6RzCA2GKOwtj9JOI,5547
17
17
  pytest_homeassistant_custom_component/test_util/__init__.py,sha256=ljLmNeblq1vEgP0vhf2P1-SuyGSHvLKVA0APSYA0Xl8,1034
18
- pytest_homeassistant_custom_component/test_util/aiohttp.py,sha256=lCGGCwZe7nSsixAkeYcfWrK-aZdCwLXS5kK97m1ZQxs,10724
18
+ pytest_homeassistant_custom_component/test_util/aiohttp.py,sha256=oPQaFRgXcAfHj9dE2Rjl1UJCBfhQp80CnQV02rXMYLo,11520
19
19
  pytest_homeassistant_custom_component/testing_config/__init__.py,sha256=SRp6h9HJi2I_vA6cPNkMiR0BTYib5XVmL03H-l3BPL0,158
20
20
  pytest_homeassistant_custom_component/testing_config/custom_components/__init__.py,sha256=-l6KCBLhwEDkCztlY6S-j53CjmKY6-A_3eX5JVS02NY,173
21
21
  pytest_homeassistant_custom_component/testing_config/custom_components/test_constant_deprecation/__init__.py,sha256=2vF_C-VP9tDjZMX7h6iJRAugtH2Bf3b4fE3i9j4vGeY,383
22
- pytest_homeassistant_custom_component-0.13.260.dist-info/licenses/LICENSE,sha256=7h-vqUxyeQNXiQgRJ8350CSHOy55M07DZuv4KG70AS8,1070
23
- pytest_homeassistant_custom_component-0.13.260.dist-info/licenses/LICENSE_HA_CORE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
- pytest_homeassistant_custom_component-0.13.260.dist-info/METADATA,sha256=p9RMTzNOWio_ETM_hfUUPNoTEnWc8fruTDxibzahe0k,5927
25
- pytest_homeassistant_custom_component-0.13.260.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
- pytest_homeassistant_custom_component-0.13.260.dist-info/entry_points.txt,sha256=bOCTSuP8RSPg0QfwdfurUShvMGWg4MI2F8rxbWx-VtQ,73
27
- pytest_homeassistant_custom_component-0.13.260.dist-info/top_level.txt,sha256=PR2cize2la22eOO7dQChJWK8dkJnuMmDC-fhafmdOWw,38
28
- pytest_homeassistant_custom_component-0.13.260.dist-info/RECORD,,
22
+ pytest_homeassistant_custom_component-0.13.262.dist-info/licenses/LICENSE,sha256=7h-vqUxyeQNXiQgRJ8350CSHOy55M07DZuv4KG70AS8,1070
23
+ pytest_homeassistant_custom_component-0.13.262.dist-info/licenses/LICENSE_HA_CORE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
+ pytest_homeassistant_custom_component-0.13.262.dist-info/METADATA,sha256=gyjUb1TSWb04qM5pOPlpSd50xNZLaxvqNWCfa-482hU,5927
25
+ pytest_homeassistant_custom_component-0.13.262.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ pytest_homeassistant_custom_component-0.13.262.dist-info/entry_points.txt,sha256=bOCTSuP8RSPg0QfwdfurUShvMGWg4MI2F8rxbWx-VtQ,73
27
+ pytest_homeassistant_custom_component-0.13.262.dist-info/top_level.txt,sha256=PR2cize2la22eOO7dQChJWK8dkJnuMmDC-fhafmdOWw,38
28
+ pytest_homeassistant_custom_component-0.13.262.dist-info/RECORD,,