fixturify 0.1.9__py3-none-any.whl → 0.1.10__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.
fixturify/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """PyTools - A collection of reusable Python utility modules."""
2
2
 
3
- __version__ = "0.1.8"
3
+ __version__ = "0.1.10"
4
4
 
5
5
  from fixturify.sql_d import sql, Phase, SqlTestConfig
6
6
  from fixturify.read_d import read
@@ -115,18 +115,33 @@ class JsonAssert:
115
115
  """
116
116
  Compare data to JSON file. Raises AssertionError if different.
117
117
 
118
+ If the file doesn't exist, it will be created with the current data.
119
+
118
120
  Args:
119
121
  relative_path: Path to JSON file, relative to caller's location
120
122
 
121
123
  Raises:
122
124
  AssertionError: If data doesn't match file content (with diff details)
123
- FileNotFoundError: If JSON file doesn't exist
124
125
  ValueError: If data can't be converted or file can't be parsed
125
126
  """
126
127
  # Resolve the path relative to the caller's file
127
128
  # Use centralized caller detection from _PathResolver
128
129
  caller_file = _PathResolver._get_caller_file(stack_level=1)
129
- expected_path = _PathResolver.resolve(relative_path, caller_file)
130
+ expected_path = _PathResolver.resolve_without_check(relative_path, caller_file)
131
+
132
+ # If file doesn't exist, create it with current data
133
+ if not expected_path.exists():
134
+ try:
135
+ actual_data = self._normalizer.normalize(self._data)
136
+ except ValueError as e:
137
+ raise ValueError(f"Cannot normalize actual data: {e}")
138
+
139
+ expected_path.parent.mkdir(parents=True, exist_ok=True)
140
+ expected_path.write_text(
141
+ json.dumps(actual_data, indent=2, ensure_ascii=False),
142
+ encoding=ENCODING
143
+ )
144
+ return
130
145
 
131
146
  # Read and parse the expected JSON file
132
147
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fixturify
3
- Version: 0.1.9
3
+ Version: 0.1.10
4
4
  Summary: A collection of convenient testing utilities for Python
5
5
  Project-URL: Homepage, https://github.com/eleven-sea/pytools
6
6
  Project-URL: Repository, https://github.com/eleven-sea/pytools
@@ -1,4 +1,4 @@
1
- fixturify/__init__.py,sha256=bQfZ0ipbm4yuVNFRwr3sKhHY7_goNcHq9K9PYvOTQGQ,484
1
+ fixturify/__init__.py,sha256=xzimdoGamcRB-WMmfeGc4W-HBYTWQ_M_ypiqWK16_2A,485
2
2
  fixturify/_utils/__init__.py,sha256=Ago2DIAS0UgTvVRxWGisxPoawDFNAB5mbjnC0hYsmNw,334
3
3
  fixturify/_utils/_constants.py,sha256=CYkqgI-ljyMcntBUP8ZCQmx7JSsLqyNxzIwNfxm2XkA,453
4
4
  fixturify/_utils/_fixture_discovery.py,sha256=u9hfoNdbLz35-X7h6fwdGuQQ8edryGNWfg_ba5i8Nq8,5185
@@ -22,7 +22,7 @@ fixturify/http_d/_stubs/_httpcore.py,sha256=WR_KZGInuVqoBBRML_T6bGe5LEMjbW4ElRem
22
22
  fixturify/http_d/_stubs/_tornado.py,sha256=Vm-hETi01xGIjVVvYmVoIOXhzSWAukae48Tzmy0afFY,3219
23
23
  fixturify/json_assert/__init__.py,sha256=eDwsoGZPMDparbzKAJ2xXorVsEVPMcbHMXMfue3a3YM,375
24
24
  fixturify/json_assert/_actual_saver.py,sha256=_BXTI2CScIUJ7UeeU1-mIKssaDrHGldlFHDtq1o_i80,2355
25
- fixturify/json_assert/_assert.py,sha256=mKX2-13mS0wZomf6OjhPfK_-UEd_Hmz9UB46z-5Krsk,6068
25
+ fixturify/json_assert/_assert.py,sha256=fTpcnADwUthCPHLJX-lJiMu3gxh9yy27zJsESO9_SRs,6641
26
26
  fixturify/json_assert/_comparator.py,sha256=67YMjRmfhaksJco2mOklAvm9yUD6gzkvxV9H9yegRCk,6226
27
27
  fixturify/json_assert/_diff_formatter.py,sha256=Aiop7FFzblkCAF2uixekFbjnRQVApZhY0tVgyWJHpk4,9971
28
28
  fixturify/json_assert/_normalizer.py,sha256=DV048q_W-T7VyOmHHtxOf5aHX7xW6Rhde9ckX6O6Ygs,3081
@@ -66,6 +66,6 @@ fixturify/sql_d/_strategies/_psycopg.py,sha256=3P75nMDJDwx1-JlRDnnPlCHWPXFOKI9Bj
66
66
  fixturify/sql_d/_strategies/_psycopg2.py,sha256=aeQRpj1k1cTtOWLFnOEaQ7IcTZ-4oV_Z4p6YHsM-iyA,1105
67
67
  fixturify/sql_d/_strategies/_registry.py,sha256=ddQpp9cU4SHA2OylsPpMBMarLyQKmV-4Ge4X395tg1Q,3346
68
68
  fixturify/sql_d/_strategies/_sqlite.py,sha256=auW6nV1bfE8UJlk4TW5fZkcqlnr_9q6Eia5bQjE2n3w,965
69
- fixturify-0.1.9.dist-info/METADATA,sha256=XgZDuNy618fafU8vfBzc2ZNBBwE_McPpf9k461OzpiU,2978
70
- fixturify-0.1.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
71
- fixturify-0.1.9.dist-info/RECORD,,
69
+ fixturify-0.1.10.dist-info/METADATA,sha256=siIGshwAVslx6ql--TW4lmqDi6_NYGd3WxK_2Vg-wcw,2979
70
+ fixturify-0.1.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
71
+ fixturify-0.1.10.dist-info/RECORD,,