assertical 0.2.1__tar.gz → 0.3.0__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 (29) hide show
  1. {assertical-0.2.1/src/assertical.egg-info → assertical-0.3.0}/PKG-INFO +4 -2
  2. {assertical-0.2.1 → assertical-0.3.0}/pyproject.toml +2 -1
  3. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fake/generator.py +11 -3
  4. {assertical-0.2.1 → assertical-0.3.0/src/assertical.egg-info}/PKG-INFO +4 -2
  5. {assertical-0.2.1 → assertical-0.3.0}/LICENSE.txt +0 -0
  6. {assertical-0.2.1 → assertical-0.3.0}/README.md +0 -0
  7. {assertical-0.2.1 → assertical-0.3.0}/setup.cfg +0 -0
  8. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/__init__.py +0 -0
  9. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/asserts/__init__.py +0 -0
  10. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/asserts/generator.py +0 -0
  11. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/asserts/pandas.py +0 -0
  12. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/asserts/time.py +0 -0
  13. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/asserts/type.py +0 -0
  14. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fake/__init__.py +0 -0
  15. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fake/asyncio.py +0 -0
  16. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fake/http.py +0 -0
  17. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fake/sqlalchemy.py +0 -0
  18. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fixtures/__init__.py +0 -0
  19. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fixtures/environment.py +0 -0
  20. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fixtures/fastapi.py +0 -0
  21. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fixtures/generator.py +0 -0
  22. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/fixtures/postgres.py +0 -0
  23. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/py.typed +0 -0
  24. {assertical-0.2.1 → assertical-0.3.0}/src/assertical/snapshot.py +0 -0
  25. {assertical-0.2.1 → assertical-0.3.0}/src/assertical.egg-info/SOURCES.txt +0 -0
  26. {assertical-0.2.1 → assertical-0.3.0}/src/assertical.egg-info/dependency_links.txt +0 -0
  27. {assertical-0.2.1 → assertical-0.3.0}/src/assertical.egg-info/requires.txt +0 -0
  28. {assertical-0.2.1 → assertical-0.3.0}/src/assertical.egg-info/top_level.txt +0 -0
  29. {assertical-0.2.1 → assertical-0.3.0}/tests/test_snapshot.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: assertical
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: Assertical - a modular library for helping write (async) integration/unit tests for fastapi/sqlalchemy/postgres projects
5
5
  Author: Battery Storage and Grid Integration Program
6
6
  Project-URL: Homepage, https://github.com/bsgip/assertical
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
17
18
  Requires-Python: >=3.9
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE.txt
@@ -45,6 +46,7 @@ Requires-Dist: psycopg; extra == "postgres"
45
46
  Requires-Dist: sqlalchemy>=2.0.0; extra == "postgres"
46
47
  Provides-Extra: xml
47
48
  Requires-Dist: pydantic_xml[lxml]; extra == "xml"
49
+ Dynamic: license-file
48
50
 
49
51
  # Assertical (assertical)
50
52
 
@@ -30,7 +30,7 @@ build-backend = "setuptools.build_meta"
30
30
 
31
31
  [project]
32
32
  name = "assertical"
33
- version = "0.2.1"
33
+ version = "0.3.0"
34
34
  description = "Assertical - a modular library for helping write (async) integration/unit tests for fastapi/sqlalchemy/postgres projects"
35
35
  authors = [{ name = "Battery Storage and Grid Integration Program" }]
36
36
  readme = "README.md"
@@ -52,6 +52,7 @@ classifiers = [
52
52
  "Programming Language :: Python :: 3.9",
53
53
  "Programming Language :: Python :: 3.10",
54
54
  "Programming Language :: Python :: 3.11",
55
+ "Programming Language :: Python :: 3.12",
55
56
  ]
56
57
 
57
58
  [project.urls]
@@ -22,6 +22,12 @@ try:
22
22
  except ImportError:
23
23
  NoneType = type(None) # type: ignore
24
24
 
25
+
26
+ try:
27
+ from types import UnionType
28
+ except ImportError:
29
+ UnionType = type(None) # type: ignore
30
+
25
31
  try:
26
32
  from pydantic import BaseModel
27
33
  except ImportError:
@@ -127,7 +133,8 @@ def get_enum_type(t: Optional[type], include_optional: bool) -> Optional[type]:
127
133
  inner_enum_type = get_optional_type_argument(t)
128
134
  assert inner_enum_type is not None
129
135
 
130
- is_union = get_origin(t) == Union and len([a for a in get_args(t) if a is not NoneType]) > 1
136
+ t_origin = get_origin(t)
137
+ is_union = (t_origin == Union or t_origin == UnionType) and len([a for a in get_args(t) if a is not NoneType]) > 1
131
138
  if is_union:
132
139
  for union_arg in get_args(t):
133
140
  arg_enum = get_enum_type(union_arg, include_optional)
@@ -201,7 +208,7 @@ def get_first_generatable_primitive(t: type, include_optional: bool) -> Optional
201
208
  # extract the type
202
209
  origin_type = get_origin(t)
203
210
  include_optional_type = include_optional and is_optional_type(t)
204
- if origin_type == Union:
211
+ if origin_type == Union or origin_type == UnionType:
205
212
  for union_arg in get_args(t):
206
213
  prim_type = get_first_generatable_primitive(union_arg, include_optional=False)
207
214
  if prim_type is not None:
@@ -261,7 +268,8 @@ def get_optional_type_argument(t: type) -> Optional[type]:
261
268
 
262
269
  If None is returned then t is NOT an optional type"""
263
270
  target_type = remove_passthrough_type(t)
264
- if get_origin(target_type) != Union:
271
+ target_type_origin = get_origin(target_type)
272
+ if target_type_origin != Union and target_type_origin != UnionType:
265
273
  return None
266
274
 
267
275
  # is this an Optional union?
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: assertical
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: Assertical - a modular library for helping write (async) integration/unit tests for fastapi/sqlalchemy/postgres projects
5
5
  Author: Battery Storage and Grid Integration Program
6
6
  Project-URL: Homepage, https://github.com/bsgip/assertical
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
17
18
  Requires-Python: >=3.9
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE.txt
@@ -45,6 +46,7 @@ Requires-Dist: psycopg; extra == "postgres"
45
46
  Requires-Dist: sqlalchemy>=2.0.0; extra == "postgres"
46
47
  Provides-Extra: xml
47
48
  Requires-Dist: pydantic_xml[lxml]; extra == "xml"
49
+ Dynamic: license-file
48
50
 
49
51
  # Assertical (assertical)
50
52
 
File without changes
File without changes
File without changes