aiobmsble 0.4__tar.gz → 0.4.1__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 (77) hide show
  1. {aiobmsble-0.4/aiobmsble.egg-info → aiobmsble-0.4.1}/PKG-INFO +6 -8
  2. {aiobmsble-0.4 → aiobmsble-0.4.1}/README.md +5 -7
  3. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/__init__.py +10 -3
  4. {aiobmsble-0.4 → aiobmsble-0.4.1/aiobmsble.egg-info}/PKG-INFO +6 -8
  5. {aiobmsble-0.4 → aiobmsble-0.4.1}/pyproject.toml +1 -1
  6. {aiobmsble-0.4 → aiobmsble-0.4.1}/tests/test_plugins.py +5 -4
  7. {aiobmsble-0.4 → aiobmsble-0.4.1}/tests/test_test_data.py +8 -6
  8. {aiobmsble-0.4 → aiobmsble-0.4.1}/tests/test_utils.py +3 -2
  9. {aiobmsble-0.4 → aiobmsble-0.4.1}/LICENSE +0 -0
  10. {aiobmsble-0.4 → aiobmsble-0.4.1}/MANIFEST.in +0 -0
  11. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/__init__.py +0 -0
  12. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/__main__.py +0 -0
  13. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/basebms.py +0 -0
  14. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/__init__.py +0 -0
  15. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/abc_bms.py +0 -0
  16. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/ant_bms.py +0 -0
  17. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/ant_leg_bms.py +0 -0
  18. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/braunpwr_bms.py +0 -0
  19. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/cbtpwr_bms.py +0 -0
  20. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/cbtpwr_vb_bms.py +0 -0
  21. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/daly_bms.py +0 -0
  22. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/dpwrcore_bms.py +0 -0
  23. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/dummy_bms.py +0 -0
  24. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/ecoworthy_bms.py +0 -0
  25. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/ective_bms.py +0 -0
  26. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/ej_bms.py +0 -0
  27. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/felicity_bms.py +0 -0
  28. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/jbd_bms.py +0 -0
  29. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/jikong_bms.py +0 -0
  30. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/neey_bms.py +0 -0
  31. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/ogt_bms.py +0 -0
  32. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/pro_bms.py +0 -0
  33. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/redodo_bms.py +0 -0
  34. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/renogy_bms.py +0 -0
  35. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/renogy_pro_bms.py +0 -0
  36. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/roypow_bms.py +0 -0
  37. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/seplos_bms.py +0 -0
  38. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/seplos_v2_bms.py +0 -0
  39. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/tdt_bms.py +0 -0
  40. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/bms/tianpwr_bms.py +0 -0
  41. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/abc_bms.json +0 -0
  42. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/ant_bms.json +0 -0
  43. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/ant_leg_bms.json +0 -0
  44. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/braunpwr_bms.json +0 -0
  45. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/cbtpwr_bms.json +0 -0
  46. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/cbtpwr_vb_bms.json +0 -0
  47. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/daly_bms.json +0 -0
  48. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/dpwrcore_bms.json +0 -0
  49. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/ecoworthy_bms.json +0 -0
  50. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/ective_bms.json +0 -0
  51. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/ej_bms.json +0 -0
  52. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/felicity_bms.json +0 -0
  53. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/ignore.json +0 -0
  54. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/jbd_bms.json +0 -0
  55. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/jikong_bms.json +0 -0
  56. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/neey_bms.json +0 -0
  57. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/ogt_bms.json +0 -0
  58. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/pro_bms.json +0 -0
  59. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/redodo_bms.json +0 -0
  60. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/renogy_bms.json +0 -0
  61. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/renogy_pro_bms.json +0 -0
  62. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/roypow_bms.json +0 -0
  63. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/seplos_bms.json +0 -0
  64. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/seplos_v2_bms.json +0 -0
  65. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/tdt_bms.json +0 -0
  66. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/test_data/tianpwr_bms.json +0 -0
  67. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble/utils.py +0 -0
  68. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble.egg-info/SOURCES.txt +0 -0
  69. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble.egg-info/dependency_links.txt +0 -0
  70. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble.egg-info/entry_points.txt +0 -0
  71. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble.egg-info/requires.txt +0 -0
  72. {aiobmsble-0.4 → aiobmsble-0.4.1}/aiobmsble.egg-info/top_level.txt +0 -0
  73. {aiobmsble-0.4 → aiobmsble-0.4.1}/setup.cfg +0 -0
  74. {aiobmsble-0.4 → aiobmsble-0.4.1}/tests/test_basebms.py +0 -0
  75. {aiobmsble-0.4 → aiobmsble-0.4.1}/tests/test_examples.py +0 -0
  76. {aiobmsble-0.4 → aiobmsble-0.4.1}/tests/test_fuzzing.py +0 -0
  77. {aiobmsble-0.4 → aiobmsble-0.4.1}/tests/test_main.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiobmsble
3
- Version: 0.4
3
+ Version: 0.4.1
4
4
  Summary: Asynchronous Python library to query battery management systems via Bluetooth Low Energy.
5
5
  Author: Patrick Loschmidt
6
6
  Maintainer: Patrick Loschmidt
@@ -114,16 +114,14 @@ if __name__ == "__main__":
114
114
  ```
115
115
 
116
116
  ### Testing
117
- For integrations tests (using pytest) the library provides advertisement data that can be used to verify detection of BMSs. To use it, include the following line into your `conftest.py`:
118
- ```python
119
- pytest_plugins: list[str] = ["aiobmsble.test_data"]
120
- ```
117
+ For integrations tests (using pytest) the library provides advertisement data that can be used to verify detection of BMSs. For your tests you can use
121
118
 
122
- For your tests you can then use
123
119
  ```python
124
- def test_advertisements(bms_advertisements) -> None:
120
+ from aiobmsble.test_data import bms_advertisements
121
+
122
+ def test_advertisements() -> None:
125
123
  """Run some tests with the advertisements"""
126
- for advertisement, bms_type, _comments in bms_advertisements:
124
+ for advertisement, bms_type, _comments in bms_advertisements():
127
125
  ...
128
126
  ```
129
127
 
@@ -82,16 +82,14 @@ if __name__ == "__main__":
82
82
  ```
83
83
 
84
84
  ### Testing
85
- For integrations tests (using pytest) the library provides advertisement data that can be used to verify detection of BMSs. To use it, include the following line into your `conftest.py`:
86
- ```python
87
- pytest_plugins: list[str] = ["aiobmsble.test_data"]
88
- ```
85
+ For integrations tests (using pytest) the library provides advertisement data that can be used to verify detection of BMSs. For your tests you can use
89
86
 
90
- For your tests you can then use
91
87
  ```python
92
- def test_advertisements(bms_advertisements) -> None:
88
+ from aiobmsble.test_data import bms_advertisements
89
+
90
+ def test_advertisements() -> None:
93
91
  """Run some tests with the advertisements"""
94
- for advertisement, bms_type, _comments in bms_advertisements:
92
+ for advertisement, bms_type, _comments in bms_advertisements():
95
93
  ...
96
94
  ```
97
95
 
@@ -5,7 +5,6 @@ import json
5
5
  from typing import Any
6
6
 
7
7
  from bleak.backends.scanner import AdvertisementData
8
- import pytest
9
8
 
10
9
  from tests.bluetooth import generate_advertisement_data
11
10
 
@@ -29,11 +28,15 @@ def _json_dict_to_advdata(json_dict: dict[str, Any]) -> AdvertisementData:
29
28
  return generate_advertisement_data(**json_dict)
30
29
 
31
30
 
32
- @pytest.fixture
33
31
  def bms_advertisements() -> BmsAdvList:
34
32
  """Provide all available BMS advertisements from test data directory.
35
33
 
36
34
  Load all *_bms.json files from the packaged test data directory.
35
+
36
+ Returns:
37
+ BmsAdvList: List of tuples containing advertisement, bms type,
38
+ and a list of comments, i.e. list[tuple[AdvertisementData, str, list[str]]]
39
+
37
40
  """
38
41
  all_data: BmsAdvList = []
39
42
 
@@ -62,11 +65,15 @@ def bms_advertisements() -> BmsAdvList:
62
65
  return all_data
63
66
 
64
67
 
65
- @pytest.fixture
66
68
  def ignore_advertisements() -> BmsAdvList:
67
69
  """Provide a list of advertisements that shall not be identified as a valid BMS.
68
70
 
69
71
  Load ignore.json files from the packaged test data directory.
72
+
73
+ Returns:
74
+ BmsAdvList: List of tuples containing advertisement, reason why not to detect,
75
+ and a list of comments, i.e. list[tuple[AdvertisementData, str, list[str]]]
76
+
70
77
  """
71
78
  data: BmsAdvList = []
72
79
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiobmsble
3
- Version: 0.4
3
+ Version: 0.4.1
4
4
  Summary: Asynchronous Python library to query battery management systems via Bluetooth Low Energy.
5
5
  Author: Patrick Loschmidt
6
6
  Maintainer: Patrick Loschmidt
@@ -114,16 +114,14 @@ if __name__ == "__main__":
114
114
  ```
115
115
 
116
116
  ### Testing
117
- For integrations tests (using pytest) the library provides advertisement data that can be used to verify detection of BMSs. To use it, include the following line into your `conftest.py`:
118
- ```python
119
- pytest_plugins: list[str] = ["aiobmsble.test_data"]
120
- ```
117
+ For integrations tests (using pytest) the library provides advertisement data that can be used to verify detection of BMSs. For your tests you can use
121
118
 
122
- For your tests you can then use
123
119
  ```python
124
- def test_advertisements(bms_advertisements) -> None:
120
+ from aiobmsble.test_data import bms_advertisements
121
+
122
+ def test_advertisements() -> None:
125
123
  """Run some tests with the advertisements"""
126
- for advertisement, bms_type, _comments in bms_advertisements:
124
+ for advertisement, bms_type, _comments in bms_advertisements():
127
125
  ...
128
126
  ```
129
127
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "aiobmsble"
7
- version = "0.4"
7
+ version = "0.4.1"
8
8
  requires-python = ">=3.12"
9
9
  description = "Asynchronous Python library to query battery management systems via Bluetooth Low Energy."
10
10
  readme = "README.md"
@@ -3,6 +3,7 @@
3
3
  from types import ModuleType
4
4
 
5
5
  from aiobmsble.basebms import BaseBMS
6
+ from aiobmsble.test_data import bms_advertisements, ignore_advertisements
6
7
  from aiobmsble.utils import bms_supported, load_bms_plugins
7
8
 
8
9
 
@@ -20,9 +21,9 @@ def test_matcher_dict(plugin_fixture: ModuleType) -> None:
20
21
  assert len(bms_class.matcher_dict_list())
21
22
 
22
23
 
23
- def test_advertisements_unique(bms_advertisements) -> None:
24
+ def test_advertisements_unique() -> None:
24
25
  """Check that each advertisement only matches one, the right BMS."""
25
- for adv, bms_real, _comments in bms_advertisements:
26
+ for adv, bms_real, _comments in bms_advertisements():
26
27
  for bms_under_test in load_bms_plugins():
27
28
  supported: bool = bms_supported(bms_under_test.BMS, adv)
28
29
  assert supported == (
@@ -30,9 +31,9 @@ def test_advertisements_unique(bms_advertisements) -> None:
30
31
  ), f"{adv} {"incorrectly matches"if supported else "does not match"} {bms_under_test}!"
31
32
 
32
33
 
33
- def test_advertisements_ignore(ignore_advertisements) -> None:
34
+ def test_advertisements_ignore() -> None:
34
35
  """Check that each advertisement only matches one, the right BMS."""
35
- for adv, reason, _comments in ignore_advertisements:
36
+ for adv, reason, _comments in ignore_advertisements():
36
37
  for bms_under_test in load_bms_plugins():
37
38
  supported: bool = bms_supported(bms_under_test.BMS, adv)
38
39
  assert (
@@ -2,15 +2,17 @@
2
2
 
3
3
  from bleak.backends.scanner import AdvertisementData
4
4
 
5
- from aiobmsble.test_data import BmsAdvList, _json_dict_to_advdata
5
+ from aiobmsble.test_data import (
6
+ _json_dict_to_advdata,
7
+ bms_advertisements,
8
+ ignore_advertisements,
9
+ )
6
10
 
7
11
 
8
- def test_test_data_availability(
9
- bms_advertisements: BmsAdvList, ignore_advertisements: BmsAdvList
10
- ) -> None:
12
+ def test_test_data_availability() -> None:
11
13
  """That fixtures work, safety measure to avoid package corruption."""
12
- assert len(bms_advertisements) > 0
13
- assert len(ignore_advertisements) > 0
14
+ assert len(bms_advertisements()) > 0
15
+ assert len(ignore_advertisements()) > 0
14
16
 
15
17
 
16
18
  def test_json_dict_to_advdata() -> None:
@@ -7,6 +7,7 @@ import pytest
7
7
 
8
8
  from aiobmsble import MatcherPattern
9
9
  from aiobmsble.basebms import BaseBMS
10
+ from aiobmsble.test_data import bms_advertisements
10
11
  from aiobmsble.utils import (
11
12
  _advertisement_matches,
12
13
  bms_cls,
@@ -36,14 +37,14 @@ def get_advertisement_by_type(advertisements, name: str) -> AdvertisementData |
36
37
  return None
37
38
 
38
39
 
39
- def test_bms_identify(bms_advertisements, plugin: ModuleType) -> None:
40
+ def test_bms_identify(plugin: ModuleType) -> None:
40
41
  """Test that each BMS is correctly detected by a pattern.
41
42
 
42
43
  This also ensures that each BMS has at least one advertisement.
43
44
  """
44
45
  bms_type: str = getattr(plugin, "__name__", "").rsplit(".", 1)[-1]
45
46
  adv: AdvertisementData | None = (
46
- get_advertisement_by_type(bms_advertisements, bms_type)
47
+ get_advertisement_by_type(bms_advertisements(), bms_type)
47
48
  if bms_type != "dummy_bms" # generate advertisement for dummy
48
49
  else generate_advertisement_data(local_name="dummy")
49
50
  )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes