Offset 1, 3 lines modified | Offset 1, 3 lines modified | ||
1 | ·6 | 1 | ·e449690145f2739dcfe81d8e7810daf5·535652·doc·optional·python-inline-snapshot-doc_0.19.3-1_all.deb |
2 | ·3ddbc791df9158261eb361c3e0c89846·36476·python·optional·python3-inline-snapshot_0.19.3-1_all.deb | 2 | ·3ddbc791df9158261eb361c3e0c89846·36476·python·optional·python3-inline-snapshot_0.19.3-1_all.deb |
Offset 1, 3 lines modified | Offset 1, 3 lines modified | ||
1 | -rw-r--r--···0········0········0········4·2025-01-16·17:36:51.000000·debian-binary | 1 | -rw-r--r--···0········0········0········4·2025-01-16·17:36:51.000000·debian-binary |
2 | -rw-r--r--···0········0········0·····3020·2025-01-16·17:36:51.000000·control.tar.xz | 2 | -rw-r--r--···0········0········0·····3020·2025-01-16·17:36:51.000000·control.tar.xz |
3 | -rw-r--r--···0········0········0···5324 | 3 | -rw-r--r--···0········0········0···532440·2025-01-16·17:36:51.000000·data.tar.xz |
Offset 1052, 15 lines modified | Offset 1052, 15 lines modified | ||
1052 | <a·id="__codelineno-2-13"·name="__codelineno-2-13"·href="#__codelineno-2-13"></a>········<span·class="nb">print</span><span·class="p">(</span><span·class="s2">"some·error"</span><span·class="p">,</span>·<span·class="n">file</span><span·class="o">=</span><span·class="n">sys</span><span·class="o">.</span><span·class="n">stderr</span><span·class="p">)</span> | 1052 | <a·id="__codelineno-2-13"·name="__codelineno-2-13"·href="#__codelineno-2-13"></a>········<span·class="nb">print</span><span·class="p">(</span><span·class="s2">"some·error"</span><span·class="p">,</span>·<span·class="n">file</span><span·class="o">=</span><span·class="n">sys</span><span·class="o">.</span><span·class="n">stderr</span><span·class="p">)</span> |
1053 | </code></pre></div></p> | 1053 | </code></pre></div></p> |
1054 | </div> | 1054 | </div> |
1055 | </div> | 1055 | </div> |
1056 | </div> | 1056 | </div> |
1057 | ············<details·class="quote"> | 1057 | ············<details·class="quote"> |
1058 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1058 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/extra.py</code></summary> |
1059 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-63">·63</a></span> | 1059 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-63">·63</a></span> |
1060 | <span·class="normal"><a·href="#__codelineno-0-64">·64</a></span> | 1060 | <span·class="normal"><a·href="#__codelineno-0-64">·64</a></span> |
1061 | <span·class="normal"><a·href="#__codelineno-0-65">·65</a></span> | 1061 | <span·class="normal"><a·href="#__codelineno-0-65">·65</a></span> |
1062 | <span·class="normal"><a·href="#__codelineno-0-66">·66</a></span> | 1062 | <span·class="normal"><a·href="#__codelineno-0-66">·66</a></span> |
1063 | <span·class="normal"><a·href="#__codelineno-0-67">·67</a></span> | 1063 | <span·class="normal"><a·href="#__codelineno-0-67">·67</a></span> |
1064 | <span·class="normal"><a·href="#__codelineno-0-68">·68</a></span> | 1064 | <span·class="normal"><a·href="#__codelineno-0-68">·68</a></span> |
1065 | <span·class="normal"><a·href="#__codelineno-0-69">·69</a></span> | 1065 | <span·class="normal"><a·href="#__codelineno-0-69">·69</a></span> |
Offset 1265, 15 lines modified | Offset 1265, 15 lines modified | ||
1265 | </span><a·id="__codelineno-1-7"·name="__codelineno-1-7"·href="#__codelineno-1-7"></a>········<span·class="mi">1</span>·<span·class="o">/</span>·<span·class="mi">0</span> | 1265 | </span><a·id="__codelineno-1-7"·name="__codelineno-1-7"·href="#__codelineno-1-7"></a>········<span·class="mi">1</span>·<span·class="o">/</span>·<span·class="mi">0</span> |
1266 | </code></pre></div></p> | 1266 | </code></pre></div></p> |
1267 | </div> | 1267 | </div> |
1268 | </div> | 1268 | </div> |
1269 | </div> | 1269 | </div> |
1270 | ············<details·class="quote"> | 1270 | ············<details·class="quote"> |
1271 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1271 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/extra.py</code></summary> |
1272 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-17">17</a></span> | 1272 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-17">17</a></span> |
1273 | <span·class="normal"><a·href="#__codelineno-0-18">18</a></span> | 1273 | <span·class="normal"><a·href="#__codelineno-0-18">18</a></span> |
1274 | <span·class="normal"><a·href="#__codelineno-0-19">19</a></span> | 1274 | <span·class="normal"><a·href="#__codelineno-0-19">19</a></span> |
1275 | <span·class="normal"><a·href="#__codelineno-0-20">20</a></span> | 1275 | <span·class="normal"><a·href="#__codelineno-0-20">20</a></span> |
1276 | <span·class="normal"><a·href="#__codelineno-0-21">21</a></span> | 1276 | <span·class="normal"><a·href="#__codelineno-0-21">21</a></span> |
1277 | <span·class="normal"><a·href="#__codelineno-0-22">22</a></span> | 1277 | <span·class="normal"><a·href="#__codelineno-0-22">22</a></span> |
1278 | <span·class="normal"><a·href="#__codelineno-0-23">23</a></span> | 1278 | <span·class="normal"><a·href="#__codelineno-0-23">23</a></span> |
Offset 1471, 15 lines modified | Offset 1471, 15 lines modified | ||
1471 | </span><a·id="__codelineno-1-8"·name="__codelineno-1-8"·href="#__codelineno-1-8"></a>········<span·class="n">warn</span><span·class="p">(</span><span·class="s2">"some·problem"</span><span·class="p">)</span> | 1471 | </span><a·id="__codelineno-1-8"·name="__codelineno-1-8"·href="#__codelineno-1-8"></a>········<span·class="n">warn</span><span·class="p">(</span><span·class="s2">"some·problem"</span><span·class="p">)</span> |
1472 | </code></pre></div></p> | 1472 | </code></pre></div></p> |
1473 | </div> | 1473 | </div> |
1474 | </div> | 1474 | </div> |
1475 | </div> | 1475 | </div> |
1476 | ············<details·class="quote"> | 1476 | ············<details·class="quote"> |
1477 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1477 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/extra.py</code></summary> |
1478 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-136">136</a></span> | 1478 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-136">136</a></span> |
1479 | <span·class="normal"><a·href="#__codelineno-0-137">137</a></span> | 1479 | <span·class="normal"><a·href="#__codelineno-0-137">137</a></span> |
1480 | <span·class="normal"><a·href="#__codelineno-0-138">138</a></span> | 1480 | <span·class="normal"><a·href="#__codelineno-0-138">138</a></span> |
1481 | <span·class="normal"><a·href="#__codelineno-0-139">139</a></span> | 1481 | <span·class="normal"><a·href="#__codelineno-0-139">139</a></span> |
1482 | <span·class="normal"><a·href="#__codelineno-0-140">140</a></span> | 1482 | <span·class="normal"><a·href="#__codelineno-0-140">140</a></span> |
1483 | <span·class="normal"><a·href="#__codelineno-0-141">141</a></span> | 1483 | <span·class="normal"><a·href="#__codelineno-0-141">141</a></span> |
1484 | <span·class="normal"><a·href="#__codelineno-0-142">142</a></span> | 1484 | <span·class="normal"><a·href="#__codelineno-0-142">142</a></span> |
Offset 82, 15 lines modified | Offset 82, 15 lines modified | ||
82 | def·test_prints(): | 82 | def·test_prints(): |
83 | ····with·prints( | 83 | ····with·prints( |
84 | ········stdout=IsStr(), | 84 | ········stdout=IsStr(), |
85 | ········stderr=snapshot("some·error\n"), | 85 | ········stderr=snapshot("some·error\n"), |
86 | ····): | 86 | ····): |
87 | ········print("hello·world") | 87 | ········print("hello·world") |
88 | ········print("some·error",·file=sys.stderr) | 88 | ········print("some·error",·file=sys.stderr) |
89 | Source·code·in·.pybuild/cpython3_3.1 | 89 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
90 | extra.py | 90 | extra.py |
91 | ····@contextlib.contextmanager | 91 | ····@contextlib.contextmanager |
92 | _\x8·_\x86_\x83·def·prints(*,·stdout:·Snapshot[str]·=·"",·stderr:·Snapshot[str]·=·""): | 92 | _\x8·_\x86_\x83·def·prints(*,·stdout:·Snapshot[str]·=·"",·stderr:·Snapshot[str]·=·""): |
93 | _\x8·_\x86_\x84·····"""Uses·`contextlib.redirect_stderr/stdout`·to·capture·the·output·and | 93 | _\x8·_\x86_\x84·····"""Uses·`contextlib.redirect_stderr/stdout`·to·capture·the·output·and |
94 | _\x8·_\x86_\x85·····compare·it·with·the·snapshots.·`dirty_equals.IsStr`·can·be·used·to | 94 | _\x8·_\x86_\x85·····compare·it·with·the·snapshots.·`dirty_equals.IsStr`·can·be·used·to |
95 | _\x8·_\x86_\x86·ignore | 95 | _\x8·_\x86_\x86·ignore |
96 | _\x8·_\x86_\x87·····the·output·if·needed. | 96 | _\x8·_\x86_\x87·····the·output·if·needed. |
Offset 178, 15 lines modified | Offset 178, 15 lines modified | ||
178 | from·inline_snapshot·import·snapshot | 178 | from·inline_snapshot·import·snapshot |
179 | from·inline_snapshot.extra·import·raises | 179 | from·inline_snapshot.extra·import·raises |
180 | def·test_raises(): | 180 | def·test_raises(): |
181 | ····with·raises(snapshot("ZeroDivisionError:·division·by·zero")): | 181 | ····with·raises(snapshot("ZeroDivisionError:·division·by·zero")): |
182 | ········1·/·0 | 182 | ········1·/·0 |
183 | Source·code·in·.pybuild/cpython3_3.1 | 183 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
184 | extra.py | 184 | extra.py |
185 | ···@contextlib.contextmanager | 185 | ···@contextlib.contextmanager |
186 | _\x81_\x87·def·raises(exception:·Snapshot[str]): | 186 | _\x81_\x87·def·raises(exception:·Snapshot[str]): |
187 | _\x81_\x88·····"""Check·that·an·exception·is·raised. | 187 | _\x81_\x88·····"""Check·that·an·exception·is·raised. |
188 | _\x81_\x89 | 188 | _\x81_\x89 |
189 | _\x82_\x80·····Parameters: | 189 | _\x82_\x80·····Parameters: |
190 | _\x82_\x81·········exception:·snapshot·which·is·compared·with·`#!python·f"{type}: | 190 | _\x82_\x81·········exception:·snapshot·which·is·compared·with·`#!python·f"{type}: |
Offset 265, 15 lines modified | Offset 265, 15 lines modified | ||
265 | from·warnings·import·warn | 265 | from·warnings·import·warn |
266 | def·test_warns(): | 266 | def·test_warns(): |
267 | ····with·warns(snapshot([(8,·"UserWarning:·some·problem")]), | 267 | ····with·warns(snapshot([(8,·"UserWarning:·some·problem")]), |
268 | include_line=True): | 268 | include_line=True): |
269 | ········warn("some·problem") | 269 | ········warn("some·problem") |
270 | Source·code·in·.pybuild/cpython3_3.1 | 270 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
271 | extra.py | 271 | extra.py |
272 | ····@contextlib.contextmanager | 272 | ····@contextlib.contextmanager |
273 | ····def·warns( | 273 | ····def·warns( |
274 | ········expected_warnings:·Snapshot[List[Warning]], | 274 | ········expected_warnings:·Snapshot[List[Warning]], |
275 | _\x81_\x83_\x86·····/, | 275 | _\x81_\x83_\x86·····/, |
276 | _\x81_\x83_\x87·····include_line:·bool·=·False, | 276 | _\x81_\x83_\x87·····include_line:·bool·=·False, |
277 | _\x81_\x83_\x88·····include_file:·bool·=·False, | 277 | _\x81_\x83_\x88·····include_file:·bool·=·False, |
Offset 1169, 15 lines modified | Offset 1169, 15 lines modified | ||
1169 | ··············</div> | 1169 | ··············</div> |
1170 | ············</td> | 1170 | ············</td> |
1171 | ··········</tr> | 1171 | ··········</tr> |
1172 | ······</tbody> | 1172 | ······</tbody> |
1173 | ····</table> | 1173 | ····</table> |
1174 | ············<details·class="quote"> | 1174 | ············<details·class="quote"> |
1175 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1175 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1176 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-137">137</a></span> | 1176 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-137">137</a></span> |
1177 | <span·class="normal"><a·href="#__codelineno-0-138">138</a></span> | 1177 | <span·class="normal"><a·href="#__codelineno-0-138">138</a></span> |
1178 | <span·class="normal"><a·href="#__codelineno-0-139">139</a></span> | 1178 | <span·class="normal"><a·href="#__codelineno-0-139">139</a></span> |
1179 | <span·class="normal"><a·href="#__codelineno-0-140">140</a></span> | 1179 | <span·class="normal"><a·href="#__codelineno-0-140">140</a></span> |
1180 | <span·class="normal"><a·href="#__codelineno-0-141">141</a></span> | 1180 | <span·class="normal"><a·href="#__codelineno-0-141">141</a></span> |
1181 | <span·class="normal"><a·href="#__codelineno-0-142">142</a></span> | 1181 | <span·class="normal"><a·href="#__codelineno-0-142">142</a></span> |
1182 | <span·class="normal"><a·href="#__codelineno-0-143">143</a></span> | 1182 | <span·class="normal"><a·href="#__codelineno-0-143">143</a></span> |
Offset 1285, 15 lines modified | Offset 1285, 15 lines modified | ||
1285 | ··············<details·class="quote"> | 1285 | ··············<details·class="quote"> |
1286 | ················<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1286 | ················<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1287 | ················<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-76">·76</a></span> | 1287 | ················<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-76">·76</a></span> |
1288 | <span·class="normal"><a·href="#__codelineno-0-77">·77</a></span> | 1288 | <span·class="normal"><a·href="#__codelineno-0-77">·77</a></span> |
1289 | <span·class="normal"><a·href="#__codelineno-0-78">·78</a></span> | 1289 | <span·class="normal"><a·href="#__codelineno-0-78">·78</a></span> |
1290 | <span·class="normal"><a·href="#__codelineno-0-79">·79</a></span> | 1290 | <span·class="normal"><a·href="#__codelineno-0-79">·79</a></span> |
1291 | <span·class="normal"><a·href="#__codelineno-0-80">·80</a></span> | 1291 | <span·class="normal"><a·href="#__codelineno-0-80">·80</a></span> |
1292 | <span·class="normal"><a·href="#__codelineno-0-81">·81</a></span> | 1292 | <span·class="normal"><a·href="#__codelineno-0-81">·81</a></span> |
1293 | <span·class="normal"><a·href="#__codelineno-0-82">·82</a></span> | 1293 | <span·class="normal"><a·href="#__codelineno-0-82">·82</a></span> |
Offset 1433, 15 lines modified | Offset 1433, 15 lines modified | ||
1433 | ····<div·class="doc·doc-contents·"> | 1433 | ····<div·class="doc·doc-contents·"> |
1434 | ········<p>Two·external·objects·are·equal·if·they·have·the·same·hash·and | 1434 | ········<p>Two·external·objects·are·equal·if·they·have·the·same·hash·and |
1435 | suffix.</p> | 1435 | suffix.</p> |
1436 | ············<details·class="quote"> | 1436 | ············<details·class="quote"> |
1437 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1437 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1438 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-116">116</a></span> | 1438 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-116">116</a></span> |
1439 | <span·class="normal"><a·href="#__codelineno-0-117">117</a></span> | 1439 | <span·class="normal"><a·href="#__codelineno-0-117">117</a></span> |
1440 | <span·class="normal"><a·href="#__codelineno-0-118">118</a></span> | 1440 | <span·class="normal"><a·href="#__codelineno-0-118">118</a></span> |
1441 | <span·class="normal"><a·href="#__codelineno-0-119">119</a></span> | 1441 | <span·class="normal"><a·href="#__codelineno-0-119">119</a></span> |
1442 | <span·class="normal"><a·href="#__codelineno-0-120">120</a></span> | 1442 | <span·class="normal"><a·href="#__codelineno-0-120">120</a></span> |
1443 | <span·class="normal"><a·href="#__codelineno-0-121">121</a></span> | 1443 | <span·class="normal"><a·href="#__codelineno-0-121">121</a></span> |
1444 | <span·class="normal"><a·href="#__codelineno-0-122">122</a></span> | 1444 | <span·class="normal"><a·href="#__codelineno-0-122">122</a></span> |
Offset 1519, 15 lines modified | Offset 1519, 15 lines modified | ||
1519 | ················<em>required</em> | 1519 | ················<em>required</em> |
1520 | ············</td> | 1520 | ············</td> |
1521 | ··········</tr> | 1521 | ··········</tr> |
1522 | ······</tbody> | 1522 | ······</tbody> |
1523 | ····</table> | 1523 | ····</table> |
1524 | ············<details·class="quote"> | 1524 | ············<details·class="quote"> |
1525 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1525 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1526 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-77">77</a></span> | 1526 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-77">77</a></span> |
1527 | <span·class="normal"><a·href="#__codelineno-0-78">78</a></span> | 1527 | <span·class="normal"><a·href="#__codelineno-0-78">78</a></span> |
1528 | <span·class="normal"><a·href="#__codelineno-0-79">79</a></span> | 1528 | <span·class="normal"><a·href="#__codelineno-0-79">79</a></span> |
1529 | <span·class="normal"><a·href="#__codelineno-0-80">80</a></span> | 1529 | <span·class="normal"><a·href="#__codelineno-0-80">80</a></span> |
1530 | <span·class="normal"><a·href="#__codelineno-0-81">81</a></span> | 1530 | <span·class="normal"><a·href="#__codelineno-0-81">81</a></span> |
1531 | <span·class="normal"><a·href="#__codelineno-0-82">82</a></span> | 1531 | <span·class="normal"><a·href="#__codelineno-0-82">82</a></span> |
1532 | <span·class="normal"><a·href="#__codelineno-0-83">83</a></span> | 1532 | <span·class="normal"><a·href="#__codelineno-0-83">83</a></span> |
Offset 1583, 15 lines modified | Offset 1583, 15 lines modified | ||
1583 | ····<div·class="doc·doc-contents·"> | 1583 | ····<div·class="doc·doc-contents·"> |
1584 | ········<p>Returns·the·representation·of·the·external·object.</p> | 1584 | ········<p>Returns·the·representation·of·the·external·object.</p> |
1585 | <p>The·length·of·the·hash·can·be·specified·in·the | 1585 | <p>The·length·of·the·hash·can·be·specified·in·the |
1586 | <a·href="configuration.html">config</a>.</p> | 1586 | <a·href="configuration.html">config</a>.</p> |
1587 | ············<details·class="quote"> | 1587 | ············<details·class="quote"> |
1588 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1588 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1589 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-103">103</a></span> | 1589 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-103">103</a></span> |
1590 | <span·class="normal"><a·href="#__codelineno-0-104">104</a></span> | 1590 | <span·class="normal"><a·href="#__codelineno-0-104">104</a></span> |
1591 | <span·class="normal"><a·href="#__codelineno-0-105">105</a></span> | 1591 | <span·class="normal"><a·href="#__codelineno-0-105">105</a></span> |
1592 | <span·class="normal"><a·href="#__codelineno-0-106">106</a></span> | 1592 | <span·class="normal"><a·href="#__codelineno-0-106">106</a></span> |
1593 | <span·class="normal"><a·href="#__codelineno-0-107">107</a></span> | 1593 | <span·class="normal"><a·href="#__codelineno-0-107">107</a></span> |
1594 | <span·class="normal"><a·href="#__codelineno-0-108">108</a></span> | 1594 | <span·class="normal"><a·href="#__codelineno-0-108">108</a></span> |
1595 | <span·class="normal"><a·href="#__codelineno-0-109">109</a></span> | 1595 | <span·class="normal"><a·href="#__codelineno-0-109">109</a></span> |
Offset 115, 15 lines modified | Offset 115, 15 lines modified | ||
115 | ·························encoded·with·"utf-8". | 115 | ·························encoded·with·"utf-8". |
116 | ·························overwrite·file·suffix.·The·default·is·".bin" | 116 | ·························overwrite·file·suffix.·The·default·is·".bin" |
117 | suffix·Optional[str]·····if·data·is·an·instance·of·bytes·and·".txt"···None | 117 | suffix·Optional[str]·····if·data·is·an·instance·of·bytes·and·".txt"···None |
118 | ·························for·str. | 118 | ·························for·str. |
119 | Returns: | 119 | Returns: |
120 | T\x8Ty\x8yp\x8pe\x8e·····D\x8De\x8es\x8sc\x8cr\x8ri\x8ip\x8pt\x8ti\x8io\x8on\x8n | 120 | T\x8Ty\x8yp\x8pe\x8e·····D\x8De\x8es\x8sc\x8cr\x8ri\x8ip\x8pt\x8ti\x8io\x8on\x8n |
121 | _\x8e_\x8x_\x8t_\x8e_\x8r_\x8n_\x8a_\x8l·The·external·data. | 121 | _\x8e_\x8x_\x8t_\x8e_\x8r_\x8n_\x8a_\x8l·The·external·data. |
122 | Source·code·in·.pybuild/cpython3_3.1 | 122 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
123 | _external.py | 123 | _external.py |
124 | ····def·outsource(data:·Union[str,·bytes],·*,·suffix:·Optional[str]·=·None)·- | 124 | ····def·outsource(data:·Union[str,·bytes],·*,·suffix:·Optional[str]·=·None)·- |
125 | ····>·external: | 125 | ····>·external: |
126 | _\x81_\x83_\x87·····"""Outsource·some·data·into·an·external·file. | 126 | _\x81_\x83_\x87·····"""Outsource·some·data·into·an·external·file. |
127 | _\x81_\x83_\x88 | 127 | _\x81_\x83_\x88 |
128 | _\x81_\x83_\x89·····```·pycon | 128 | _\x81_\x83_\x89·····```·pycon |
129 | _\x81_\x84_\x80·····>>>·png_data·=·b"some_bytes"··#·should·be·the·replaced·with·your·actual | 129 | _\x81_\x84_\x80·····>>>·png_data·=·b"some_bytes"··#·should·be·the·replaced·with·your·actual |
Offset 167, 15 lines modified | Offset 167, 15 lines modified | ||
167 | _\x81_\x87_\x88 | 167 | _\x81_\x87_\x88 |
168 | _\x81_\x87_\x89·····if·not·storage.lookup_all(name): | 168 | _\x81_\x87_\x89·····if·not·storage.lookup_all(name): |
169 | _\x81_\x88_\x80·········path·=·hash·+·"-new"·+·suffix | 169 | _\x81_\x88_\x80·········path·=·hash·+·"-new"·+·suffix |
170 | _\x81_\x88_\x81·········storage.save(path,·data) | 170 | _\x81_\x88_\x81·········storage.save(path,·data) |
171 | ········return·external(name) | 171 | ········return·external(name) |
172 | i\x8in\x8nl\x8li\x8in\x8ne\x8e_\x8_s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t.\x8.e\x8ex\x8xt\x8te\x8er\x8rn\x8na\x8al\x8l·_\x8?\x8¶ | 172 | i\x8in\x8nl\x8li\x8in\x8ne\x8e_\x8_s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t.\x8.e\x8ex\x8xt\x8te\x8er\x8rn\x8na\x8al\x8l·_\x8?\x8¶ |
173 | Source·code·in·.pybuild/cpython3_3.1 | 173 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
174 | _external.py | 174 | _external.py |
175 | ····class·external: | 175 | ····class·external: |
176 | ········def·__init__(self,·name:·str): | 176 | ········def·__init__(self,·name:·str): |
177 | ············"""External·objects·are·used·as·a·representation·for·outsourced | 177 | ············"""External·objects·are·used·as·a·representation·for·outsourced |
178 | _\x8·_\x87_\x86·data. | 178 | _\x8·_\x87_\x86·data. |
179 | _\x8·_\x87_\x87·········You·should·not·create·them·directly. | 179 | _\x8·_\x87_\x87·········You·should·not·create·them·directly. |
180 | _\x8·_\x87_\x88 | 180 | _\x8·_\x87_\x88 |
Offset 236, 15 lines modified | Offset 236, 15 lines modified | ||
236 | _\x81_\x83_\x83·········return·True | 236 | _\x81_\x83_\x83·········return·True |
237 | _\x81_\x83_\x84 | 237 | _\x81_\x83_\x84 |
238 | ········def·_load_value(self): | 238 | ········def·_load_value(self): |
239 | ············assert·storage·is·not·None | 239 | ············assert·storage·is·not·None |
240 | ············return·storage.read(self._path) | 240 | ············return·storage.read(self._path) |
241 | _\x8__\x8_e\x8eq\x8q_\x8__\x8_(\x8(o\x8ot\x8th\x8he\x8er\x8r)\x8)·_\x8?\x8¶ | 241 | _\x8__\x8_e\x8eq\x8q_\x8__\x8_(\x8(o\x8ot\x8th\x8he\x8er\x8r)\x8)·_\x8?\x8¶ |
242 | Two·external·objects·are·equal·if·they·have·the·same·hash·and·suffix. | 242 | Two·external·objects·are·equal·if·they·have·the·same·hash·and·suffix. |
243 | Source·code·in·.pybuild/cpython3_3.1 | 243 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
244 | _external.py | 244 | _external.py |
245 | _\x81_\x81_\x86·def·__eq__(self,·other): | 245 | _\x81_\x81_\x86·def·__eq__(self,·other): |
246 | _\x81_\x81_\x87·····"""Two·external·objects·are·equal·if·they·have·the·same·hash·and | 246 | _\x81_\x81_\x87·····"""Two·external·objects·are·equal·if·they·have·the·same·hash·and |
247 | _\x81_\x81_\x88·····suffix.""" | 247 | _\x81_\x81_\x88·····suffix.""" |
248 | _\x81_\x81_\x89·····if·not·isinstance(other,·external): | 248 | _\x81_\x81_\x89·····if·not·isinstance(other,·external): |
249 | _\x81_\x82_\x80·········return·NotImplemented | 249 | _\x81_\x82_\x80·········return·NotImplemented |
250 | _\x81_\x82_\x81 | 250 | _\x81_\x82_\x81 |
Offset 265, 15 lines modified | Offset 265, 15 lines modified | ||
265 | containing·the·Pytest·configuration·file,·if·any.·To·store·data·in·a·different | 265 | containing·the·Pytest·configuration·file,·if·any.·To·store·data·in·a·different |
266 | location,·set·the·storage-dir·option·in·pyproject.toml.·Data·which·is | 266 | location,·set·the·storage-dir·option·in·pyproject.toml.·Data·which·is |
267 | outsourced·but·not·referenced·in·the·source·code·jet·has·a·'-new'·suffix·in·the | 267 | outsourced·but·not·referenced·in·the·source·code·jet·has·a·'-new'·suffix·in·the |
268 | filename. | 268 | filename. |
269 | Parameters: | 269 | Parameters: |
270 | N\x8Na\x8am\x8me\x8e·T\x8Ty\x8yp\x8pe\x8e·D\x8De\x8es\x8sc\x8cr\x8ri\x8ip\x8pt\x8ti\x8io\x8on\x8n·····························D\x8De\x8ef\x8fa\x8au\x8ul\x8lt\x8t | 270 | N\x8Na\x8am\x8me\x8e·T\x8Ty\x8yp\x8pe\x8e·D\x8De\x8es\x8sc\x8cr\x8ri\x8ip\x8pt\x8ti\x8io\x8on\x8n·····························D\x8De\x8ef\x8fa\x8au\x8ul\x8lt\x8t |
271 | name·str··the·name·of·the·external·stored·object.·r\x8re\x8eq\x8qu\x8ui\x8ir\x8re\x8ed\x8d | 271 | name·str··the·name·of·the·external·stored·object.·r\x8re\x8eq\x8qu\x8ui\x8ir\x8re\x8ed\x8d |
272 | Source·code·in·.pybuild/cpython3_3.1 | 272 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
273 | _external.py | 273 | _external.py |
274 | ···def·__init__(self,·name:·str): | 274 | ···def·__init__(self,·name:·str): |
275 | ·······"""External·objects·are·used·as·a·representation·for·outsourced·data. | 275 | ·······"""External·objects·are·used·as·a·representation·for·outsourced·data. |
276 | _\x87_\x87·····You·should·not·create·them·directly. | 276 | _\x87_\x87·····You·should·not·create·them·directly. |
277 | _\x87_\x88 | 277 | _\x87_\x88 |
278 | _\x87_\x89·····The·external·data·is·by·default·stored·inside | 278 | _\x87_\x89·····The·external·data·is·by·default·stored·inside |
279 | _\x88_\x80·`<pytest_config_dir>/.inline-snapshot/external`, | 279 | _\x88_\x80·`<pytest_config_dir>/.inline-snapshot/external`, |
Offset 296, 15 lines modified | Offset 296, 15 lines modified | ||
296 | _\x89_\x87·········raise·ValueError( | 296 | _\x89_\x87·········raise·ValueError( |
297 | ···············"path·has·to·be·of·the·form·<hash>.<suffix>·or | 297 | ···············"path·has·to·be·of·the·form·<hash>.<suffix>·or |
298 | ···<partial_hash>*.<suffix>" | 298 | ···<partial_hash>*.<suffix>" |
299 | ···········) | 299 | ···········) |
300 | _\x8__\x8_r\x8re\x8ep\x8pr\x8r_\x8__\x8_(\x8()\x8)·_\x8?\x8¶ | 300 | _\x8__\x8_r\x8re\x8ep\x8pr\x8r_\x8__\x8_(\x8()\x8)·_\x8?\x8¶ |
301 | Returns·the·representation·of·the·external·object. | 301 | Returns·the·representation·of·the·external·object. |
302 | The·length·of·the·hash·can·be·specified·in·the·_\x8c_\x8o_\x8n_\x8f_\x8i_\x8g. | 302 | The·length·of·the·hash·can·be·specified·in·the·_\x8c_\x8o_\x8n_\x8f_\x8i_\x8g. |
303 | Source·code·in·.pybuild/cpython3_3.1 | 303 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
304 | _external.py | 304 | _external.py |
305 | _\x81_\x80_\x83·def·__repr__(self): | 305 | _\x81_\x80_\x83·def·__repr__(self): |
306 | _\x81_\x80_\x84·····"""Returns·the·representation·of·the·external·object. | 306 | _\x81_\x80_\x84·····"""Returns·the·representation·of·the·external·object. |
307 | _\x81_\x80_\x85 | 307 | _\x81_\x80_\x85 |
308 | _\x81_\x80_\x86·····The·length·of·the·hash·can·be·specified·in·the | 308 | _\x81_\x80_\x86·····The·length·of·the·hash·can·be·specified·in·the |
309 | _\x81_\x80_\x87·····[config](configuration.md). | 309 | _\x81_\x80_\x87·····[config](configuration.md). |
310 | _\x81_\x80_\x88·····""" | 310 | _\x81_\x80_\x88·····""" |
Offset 969, 16 lines modified | Offset 969, 16 lines modified | ||
969 | <a·id="__codelineno-1-4"·name="__codelineno-1-4"·href="#__codelineno-1-4"></a><span·class="k">def</span>·<span·class="nf">test_something</span><span·class="p">():</span> | 969 | <a·id="__codelineno-1-4"·name="__codelineno-1-4"·href="#__codelineno-1-4"></a><span·class="k">def</span>·<span·class="nf">test_something</span><span·class="p">():</span> |
970 | <a·id="__codelineno-1-5"·name="__codelineno-1-5"·href="#__codelineno-1-5"></a>····<span·class="k">assert</span>·<span·class="mi">1</span>·<span·class="o">==</span>·<span·class="n">snapshot</span><span·class="p">()</span> | 970 | <a·id="__codelineno-1-5"·name="__codelineno-1-5"·href="#__codelineno-1-5"></a>····<span·class="k">assert</span>·<span·class="mi">1</span>·<span·class="o">==</span>·<span·class="n">snapshot</span><span·class="p">()</span> |
971 | <a·id="__codelineno-1-6"·name="__codelineno-1-6"·href="#__codelineno-1-6"></a>····<span·class="k">assert</span>·<span·class="mi">2</span>·<span·class="o"><=</span>·<span·class="n">snapshot</span><span·class="p">(</span><span·class="mi">5</span><span·class="p">)</span> | 971 | <a·id="__codelineno-1-6"·name="__codelineno-1-6"·href="#__codelineno-1-6"></a>····<span·class="k">assert</span>·<span·class="mi">2</span>·<span·class="o"><=</span>·<span·class="n">snapshot</span><span·class="p">(</span><span·class="mi">5</span><span·class="p">)</span> |
972 | </code></pre></div> | 972 | </code></pre></div> |
973 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Blue">>·pytest·test_something.py·--inline-snapshot=create,report</span> | 973 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Blue">>·pytest·test_something.py·--inline-snapshot=create,report</span> |
974 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a><span·class="·-Color·-Color-Bold">=============================·test·session·starts·==============================</span> | 974 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a><span·class="·-Color·-Color-Bold">=============================·test·session·starts·==============================</span> |
975 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 | 975 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 |
976 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp. | 976 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp.5mj2by8HuS |
977 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:· | 977 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer-0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1 |
978 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item | 978 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item |
979 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> | 979 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> |
980 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·<span·class="·-Color·-Color-Green">.······················································[100%]</span> | 980 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·<span·class="·-Color·-Color-Green">.······················································[100%]</span> |
981 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a>===============================·inline·snapshot·================================ | 981 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a>===============================·inline·snapshot·================================ |
982 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>───────────────────────────────·Create·snapshots·─────────────────────────────── | 982 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>───────────────────────────────·Create·snapshots·─────────────────────────────── |
983 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>+-----------------------------·test_something.py·------------------------------+ | 983 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>+-----------------------------·test_something.py·------------------------------+ |
984 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>|·@@·-2,5·+2,5·@@······························································| | 984 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>|·@@·-2,5·+2,5·@@······························································| |
Offset 1003, 51 lines modified | Offset 1003, 51 lines modified | ||
1003 | <a·id="__codelineno-0-31"·name="__codelineno-0-31"·href="#__codelineno-0-31"></a>|·+····assert·2·<=·snapshot(2)·················································| | 1003 | <a·id="__codelineno-0-31"·name="__codelineno-0-31"·href="#__codelineno-0-31"></a>|·+····assert·2·<=·snapshot(2)·················································| |
1004 | <a·id="__codelineno-0-32"·name="__codelineno-0-32"·href="#__codelineno-0-32"></a>+------------------------------------------------------------------------------+ | 1004 | <a·id="__codelineno-0-32"·name="__codelineno-0-32"·href="#__codelineno-0-32"></a>+------------------------------------------------------------------------------+ |
1005 | <a·id="__codelineno-0-33"·name="__codelineno-0-33"·href="#__codelineno-0-33"></a>These·changes·are·not·applied. | 1005 | <a·id="__codelineno-0-33"·name="__codelineno-0-33"·href="#__codelineno-0-33"></a>These·changes·are·not·applied. |
1006 | <a·id="__codelineno-0-34"·name="__codelineno-0-34"·href="#__codelineno-0-34"></a>Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with· | 1006 | <a·id="__codelineno-0-34"·name="__codelineno-0-34"·href="#__codelineno-0-34"></a>Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with· |
1007 | <a·id="__codelineno-0-35"·name="__codelineno-0-35"·href="#__codelineno-0-35"></a>--inline-snapshot=review | 1007 | <a·id="__codelineno-0-35"·name="__codelineno-0-35"·href="#__codelineno-0-35"></a>--inline-snapshot=review |
1008 | <a·id="__codelineno-0-36"·name="__codelineno-0-36"·href="#__codelineno-0-36"></a> | 1008 | <a·id="__codelineno-0-36"·name="__codelineno-0-36"·href="#__codelineno-0-36"></a> |
1009 | <a·id="__codelineno-0-37"·name="__codelineno-0-37"·href="#__codelineno-0-37"></a> | 1009 | <a·id="__codelineno-0-37"·name="__codelineno-0-37"·href="#__codelineno-0-37"></a> |
1010 | <a·id="__codelineno-0-38"·name="__codelineno-0-38"·href="#__codelineno-0-38"></a><span·class="·-Color·-Color-Green">==============================·</span><span·class="·-Color·-Color-Bold·-Color-Bold-Green">1·passed</span><span·class="·-Color·-Color-Green">·in· | 1010 | <a·id="__codelineno-0-38"·name="__codelineno-0-38"·href="#__codelineno-0-38"></a><span·class="·-Color·-Color-Green">==============================·</span><span·class="·-Color·-Color-Bold·-Color-Bold-Green">1·passed</span><span·class="·-Color·-Color-Green">·in·0.90s·===============================</span> |
1011 | </code></pre></div> | 1011 | </code></pre></div> |
1012 | <h2·id="-inline-snapshotshort-report">--inline-snapshot=short-report<a·class="headerlink"·href="#-inline-snapshotshort-report"·title="Permanent·link">¶</a></h2> | 1012 | <h2·id="-inline-snapshotshort-report">--inline-snapshot=short-report<a·class="headerlink"·href="#-inline-snapshotshort-report"·title="Permanent·link">¶</a></h2> |
1013 | <p>give·a·short·report·over·which·changes·can·be·made·to·the·snapshots</p> | 1013 | <p>give·a·short·report·over·which·changes·can·be·made·to·the·snapshots</p> |
1014 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Blue">>·pytest·test_something.py·--inline-snapshot=short-report</span> | 1014 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Blue">>·pytest·test_something.py·--inline-snapshot=short-report</span> |
1015 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a><span·class="·-Color·-Color-Bold">=============================·test·session·starts·==============================</span> | 1015 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a><span·class="·-Color·-Color-Bold">=============================·test·session·starts·==============================</span> |
1016 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 | 1016 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 |
1017 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp. | 1017 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp.x4eZJlhZMA |
1018 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:· | 1018 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer-0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1 |
1019 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item | 1019 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item |
1020 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> | 1020 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> |
1021 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·<span·class="·-Color·-Color-Green">.</span><span·class="·-Color·-Color-Red">E·····················································[100%]</span> | 1021 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·<span·class="·-Color·-Color-Green">.</span><span·class="·-Color·-Color-Red">E·····················································[100%]</span> |
1022 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a> | 1022 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a> |
1023 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>====================================·ERRORS·==================================== | 1023 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>====================================·ERRORS·==================================== |
1024 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Red">_____________________·ERROR·at·teardown·of·test_something·______________________</span> | 1024 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Red">_____________________·ERROR·at·teardown·of·test_something·______________________</span> |
1025 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>your·snapshot·is·missing·one·value. | 1025 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>your·snapshot·is·missing·one·value. |
1026 | <a·id="__codelineno-0-13"·name="__codelineno-0-13"·href="#__codelineno-0-13"></a>===============================·inline·snapshot·================================ | 1026 | <a·id="__codelineno-0-13"·name="__codelineno-0-13"·href="#__codelineno-0-13"></a>===============================·inline·snapshot·================================ |
1027 | <a·id="__codelineno-0-14"·name="__codelineno-0-14"·href="#__codelineno-0-14"></a>Info:·one·snapshot·can·be·trimmed·(--inline-snapshot=trim) | 1027 | <a·id="__codelineno-0-14"·name="__codelineno-0-14"·href="#__codelineno-0-14"></a>Info:·one·snapshot·can·be·trimmed·(--inline-snapshot=trim) |
1028 | <a·id="__codelineno-0-15"·name="__codelineno-0-15"·href="#__codelineno-0-15"></a>Error:·one·snapshot·is·missing·a·value·(--inline-snapshot=create) | 1028 | <a·id="__codelineno-0-15"·name="__codelineno-0-15"·href="#__codelineno-0-15"></a>Error:·one·snapshot·is·missing·a·value·(--inline-snapshot=create) |
1029 | <a·id="__codelineno-0-16"·name="__codelineno-0-16"·href="#__codelineno-0-16"></a> | 1029 | <a·id="__codelineno-0-16"·name="__codelineno-0-16"·href="#__codelineno-0-16"></a> |
1030 | <a·id="__codelineno-0-17"·name="__codelineno-0-17"·href="#__codelineno-0-17"></a>You·can·also·use·--inline-snapshot=review·to·approve·the·changes·interactively | 1030 | <a·id="__codelineno-0-17"·name="__codelineno-0-17"·href="#__codelineno-0-17"></a>You·can·also·use·--inline-snapshot=review·to·approve·the·changes·interactively |
1031 | <a·id="__codelineno-0-18"·name="__codelineno-0-18"·href="#__codelineno-0-18"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Cyan">===========================·short·test·summary·info·============================</span> | 1031 | <a·id="__codelineno-0-18"·name="__codelineno-0-18"·href="#__codelineno-0-18"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Cyan">===========================·short·test·summary·info·============================</span> |
1032 | <a·id="__codelineno-0-19"·name="__codelineno-0-19"·href="#__codelineno-0-19"></a><span·class="·-Color·-Color-Red">ERROR</span>·test_something.py::<span·class="·-Color·-Color-Bold">test_something</span>·-·Failed:·your·snapshot·is·missing·one·value. | 1032 | <a·id="__codelineno-0-19"·name="__codelineno-0-19"·href="#__codelineno-0-19"></a><span·class="·-Color·-Color-Red">ERROR</span>·test_something.py::<span·class="·-Color·-Color-Bold">test_something</span>·-·Failed:·your·snapshot·is·missing·one·value. |
1033 | <a·id="__codelineno-0-20"·name="__codelineno-0-20"·href="#__codelineno-0-20"></a><span·class="·-Color·-Color-Red">==========================·</span><span·class="·-Color·-Color-Green">1·passed</span>,·<span·class="·-Color·-Color-Bold·-Color-Bold-Red">1·error</span><span·class="·-Color·-Color-Red">·in· | 1033 | <a·id="__codelineno-0-20"·name="__codelineno-0-20"·href="#__codelineno-0-20"></a><span·class="·-Color·-Color-Red">==========================·</span><span·class="·-Color·-Color-Green">1·passed</span>,·<span·class="·-Color·-Color-Bold·-Color-Bold-Red">1·error</span><span·class="·-Color·-Color-Red">·in·0.86s·==========================</span> |
1034 | </code></pre></div> | 1034 | </code></pre></div> |
1035 | <div·class="admonition·info"> | 1035 | <div·class="admonition·info"> |
1036 | <p·class="admonition-title">Info</p> | 1036 | <p·class="admonition-title">Info</p> |
1037 | <p>short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled·pytest·assert-rewriting. | 1037 | <p>short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled·pytest·assert-rewriting. |
1038 | This·option·will·be·replaced·with·<em>report</em>·when·this·restriction·is·lifted.</p> | 1038 | This·option·will·be·replaced·with·<em>report</em>·when·this·restriction·is·lifted.</p> |
1039 | </div> | 1039 | </div> |
1040 | <h2·id="-inline-snapshotreport">--inline-snapshot=report<a·class="headerlink"·href="#-inline-snapshotreport"·title="Permanent·link">¶</a></h2> | 1040 | <h2·id="-inline-snapshotreport">--inline-snapshot=report<a·class="headerlink"·href="#-inline-snapshotreport"·title="Permanent·link">¶</a></h2> |
1041 | <p>Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots</p> | 1041 | <p>Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots</p> |
1042 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Blue">>·pytest·test_something.py·--inline-snapshot=report</span> | 1042 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Blue">>·pytest·test_something.py·--inline-snapshot=report</span> |
1043 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a><span·class="·-Color·-Color-Bold">=============================·test·session·starts·==============================</span> | 1043 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a><span·class="·-Color·-Color-Bold">=============================·test·session·starts·==============================</span> |
1044 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 | 1044 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 |
1045 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp. | 1045 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp.pfZBfJqYux |
1046 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:· | 1046 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer-0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1 |
1047 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item | 1047 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item |
1048 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> | 1048 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> |
1049 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·<span·class="·-Color·-Color-Green">.</span><span·class="·-Color·-Color-Red">E·····················································[100%]</span> | 1049 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·<span·class="·-Color·-Color-Green">.</span><span·class="·-Color·-Color-Red">E·····················································[100%]</span> |
1050 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a> | 1050 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a> |
1051 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>====================================·ERRORS·==================================== | 1051 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>====================================·ERRORS·==================================== |
1052 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Red">_____________________·ERROR·at·teardown·of·test_something·______________________</span> | 1052 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Red">_____________________·ERROR·at·teardown·of·test_something·______________________</span> |
1053 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>your·snapshot·is·missing·one·value. | 1053 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>your·snapshot·is·missing·one·value. |
Offset 1079, 23 lines modified | Offset 1079, 23 lines modified | ||
1079 | <a·id="__codelineno-0-38"·name="__codelineno-0-38"·href="#__codelineno-0-38"></a>+------------------------------------------------------------------------------+ | 1079 | <a·id="__codelineno-0-38"·name="__codelineno-0-38"·href="#__codelineno-0-38"></a>+------------------------------------------------------------------------------+ |
1080 | <a·id="__codelineno-0-39"·name="__codelineno-0-39"·href="#__codelineno-0-39"></a>These·changes·are·not·applied. | 1080 | <a·id="__codelineno-0-39"·name="__codelineno-0-39"·href="#__codelineno-0-39"></a>These·changes·are·not·applied. |
1081 | <a·id="__codelineno-0-40"·name="__codelineno-0-40"·href="#__codelineno-0-40"></a>Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with· | 1081 | <a·id="__codelineno-0-40"·name="__codelineno-0-40"·href="#__codelineno-0-40"></a>Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with· |
1082 | <a·id="__codelineno-0-41"·name="__codelineno-0-41"·href="#__codelineno-0-41"></a>--inline-snapshot=review | 1082 | <a·id="__codelineno-0-41"·name="__codelineno-0-41"·href="#__codelineno-0-41"></a>--inline-snapshot=review |
1083 | <a·id="__codelineno-0-42"·name="__codelineno-0-42"·href="#__codelineno-0-42"></a> | 1083 | <a·id="__codelineno-0-42"·name="__codelineno-0-42"·href="#__codelineno-0-42"></a> |
1084 | <a·id="__codelineno-0-43"·name="__codelineno-0-43"·href="#__codelineno-0-43"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Cyan">===========================·short·test·summary·info·============================</span> | 1084 | <a·id="__codelineno-0-43"·name="__codelineno-0-43"·href="#__codelineno-0-43"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Cyan">===========================·short·test·summary·info·============================</span> |
1085 | <a·id="__codelineno-0-44"·name="__codelineno-0-44"·href="#__codelineno-0-44"></a><span·class="·-Color·-Color-Red">ERROR</span>·test_something.py::<span·class="·-Color·-Color-Bold">test_something</span>·-·Failed:·your·snapshot·is·missing·one·value. | 1085 | <a·id="__codelineno-0-44"·name="__codelineno-0-44"·href="#__codelineno-0-44"></a><span·class="·-Color·-Color-Red">ERROR</span>·test_something.py::<span·class="·-Color·-Color-Bold">test_something</span>·-·Failed:·your·snapshot·is·missing·one·value. |
1086 | <a·id="__codelineno-0-45"·name="__codelineno-0-45"·href="#__codelineno-0-45"></a><span·class="·-Color·-Color-Red">==========================·</span><span·class="·-Color·-Color-Green">1·passed</span>,·<span·class="·-Color·-Color-Bold·-Color-Bold-Red">1·error</span><span·class="·-Color·-Color-Red">·in· | 1086 | <a·id="__codelineno-0-45"·name="__codelineno-0-45"·href="#__codelineno-0-45"></a><span·class="·-Color·-Color-Red">==========================·</span><span·class="·-Color·-Color-Green">1·passed</span>,·<span·class="·-Color·-Color-Bold·-Color-Bold-Red">1·error</span><span·class="·-Color·-Color-Red">·in·0.86s·==========================</span> |
1087 | </code></pre></div> | 1087 | </code></pre></div> |
1088 | <h2·id="-inline-snapshotreview">--inline-snapshot=review<a·class="headerlink"·href="#-inline-snapshotreview"·title="Permanent·link">¶</a></h2> | 1088 | <h2·id="-inline-snapshotreview">--inline-snapshot=review<a·class="headerlink"·href="#-inline-snapshotreview"·title="Permanent·link">¶</a></h2> |
1089 | <p>Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes</p> | 1089 | <p>Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes</p> |
1090 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Blue">>·pytest·test_something.py·--inline-snapshot=review</span> | 1090 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a><span·class="·-Color·-Color-Bold·-Color-Bold-Blue">>·pytest·test_something.py·--inline-snapshot=review</span> |
1091 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a><span·class="·-Color·-Color-Bold">=============================·test·session·starts·==============================</span> | 1091 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a><span·class="·-Color·-Color-Bold">=============================·test·session·starts·==============================</span> |
1092 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 | 1092 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 |
1093 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp. | 1093 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp.lriEsKZIr3 |
1094 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:· | 1094 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer-0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1 |
1095 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item | 1095 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item |
1096 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> | 1096 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> |
1097 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·<span·class="·-Color·-Color-Green">.······················································[100%]</span> | 1097 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·<span·class="·-Color·-Color-Green">.······················································[100%]</span> |
1098 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a>===============================·inline·snapshot·================================ | 1098 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a>===============================·inline·snapshot·================================ |
1099 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>───────────────────────────────·Create·snapshots·─────────────────────────────── | 1099 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>───────────────────────────────·Create·snapshots·─────────────────────────────── |
1100 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>+-----------------------------·test_something.py·------------------------------+ | 1100 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>+-----------------------------·test_something.py·------------------------------+ |
1101 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>|·@@·-2,5·+2,5·@@······························································| | 1101 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>|·@@·-2,5·+2,5·@@······························································| |
Offset 1116, 15 lines modified | Offset 1116, 15 lines modified | ||
1116 | <a·id="__codelineno-0-27"·name="__codelineno-0-27"·href="#__codelineno-0-27"></a>|··def·test_something():·······················································| | 1116 | <a·id="__codelineno-0-27"·name="__codelineno-0-27"·href="#__codelineno-0-27"></a>|··def·test_something():·······················································| |
1117 | <a·id="__codelineno-0-28"·name="__codelineno-0-28"·href="#__codelineno-0-28"></a>|······assert·1·==·snapshot(1)·················································| | 1117 | <a·id="__codelineno-0-28"·name="__codelineno-0-28"·href="#__codelineno-0-28"></a>|······assert·1·==·snapshot(1)·················································| |
1118 | <a·id="__codelineno-0-29"·name="__codelineno-0-29"·href="#__codelineno-0-29"></a>|·-····assert·2·<=·snapshot(5)·················································| | 1118 | <a·id="__codelineno-0-29"·name="__codelineno-0-29"·href="#__codelineno-0-29"></a>|·-····assert·2·<=·snapshot(5)·················································| |
1119 | <a·id="__codelineno-0-30"·name="__codelineno-0-30"·href="#__codelineno-0-30"></a>|·+····assert·2·<=·snapshot(2)·················································| | 1119 | <a·id="__codelineno-0-30"·name="__codelineno-0-30"·href="#__codelineno-0-30"></a>|·+····assert·2·<=·snapshot(2)·················································| |
1120 | <a·id="__codelineno-0-31"·name="__codelineno-0-31"·href="#__codelineno-0-31"></a>+------------------------------------------------------------------------------+ | 1120 | <a·id="__codelineno-0-31"·name="__codelineno-0-31"·href="#__codelineno-0-31"></a>+------------------------------------------------------------------------------+ |
1121 | <a·id="__codelineno-0-32"·name="__codelineno-0-32"·href="#__codelineno-0-32"></a>do·you·want·to·trim·these·snapshots?·[y/n]·(n):· | 1121 | <a·id="__codelineno-0-32"·name="__codelineno-0-32"·href="#__codelineno-0-32"></a>do·you·want·to·trim·these·snapshots?·[y/n]·(n):· |
1122 | <a·id="__codelineno-0-33"·name="__codelineno-0-33"·href="#__codelineno-0-33"></a> | 1122 | <a·id="__codelineno-0-33"·name="__codelineno-0-33"·href="#__codelineno-0-33"></a> |
1123 | <a·id="__codelineno-0-34"·name="__codelineno-0-34"·href="#__codelineno-0-34"></a><span·class="·-Color·-Color-Green">==============================·</span><span·class="·-Color·-Color-Bold·-Color-Bold-Green">1·passed</span><span·class="·-Color·-Color-Green">·in· | 1123 | <a·id="__codelineno-0-34"·name="__codelineno-0-34"·href="#__codelineno-0-34"></a><span·class="·-Color·-Color-Green">==============================·</span><span·class="·-Color·-Color-Bold·-Color-Bold-Green">1·passed</span><span·class="·-Color·-Color-Green">·in·0.93s·===============================</span> |
1124 | </code></pre></div> | 1124 | </code></pre></div> |
1125 | <h2·id="-inline-snapshotdisable">--inline-snapshot=disable<a·class="headerlink"·href="#-inline-snapshotdisable"·title="Permanent·link">¶</a></h2> | 1125 | <h2·id="-inline-snapshotdisable">--inline-snapshot=disable<a·class="headerlink"·href="#-inline-snapshotdisable"·title="Permanent·link">¶</a></h2> |
1126 | <p>Disables·all·the·snapshot·logic.·<code>snapshot(x)</code>·will·just·return·<code>x</code>. | 1126 | <p>Disables·all·the·snapshot·logic.·<code>snapshot(x)</code>·will·just·return·<code>x</code>. |
1127 | This·can·be·used·if·you·think·exclude·that·snapshot·logic·causes·a·problem·in·your·tests,·or·if·you·want·to·speedup·your·CI.</p> | 1127 | This·can·be·used·if·you·think·exclude·that·snapshot·logic·causes·a·problem·in·your·tests,·or·if·you·want·to·speedup·your·CI.</p> |
1128 | <div·class="admonition·info"> | 1128 | <div·class="admonition·info"> |
1129 | <p·class="admonition-title">deprecation</p> | 1129 | <p·class="admonition-title">deprecation</p> |
1130 | <p>This·option·was·previously·called·<code>--inline-snapshot-disable</code></p> | 1130 | <p>This·option·was·previously·called·<code>--inline-snapshot-disable</code></p> |
Offset 66, 17 lines modified | Offset 66, 17 lines modified | ||
66 | def·test_something(): | 66 | def·test_something(): |
67 | ····assert·1·==·snapshot() | 67 | ····assert·1·==·snapshot() |
68 | ····assert·2·<=·snapshot(5) | 68 | ····assert·2·<=·snapshot(5) |
69 | >·pytest·test_something.py·--inline-snapshot=create,report | 69 | >·pytest·test_something.py·--inline-snapshot=create,report |
70 | =============================·test·session·starts | 70 | =============================·test·session·starts |
71 | ============================== | 71 | ============================== |
72 | platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 | 72 | platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 |
73 | rootdir:·/tmp/tmp.Beh8U0N4Ai | ||
74 | plugins:·time-machine-2.16.0,·mock-3.14.0,·subtests-0.13.1,·hypothesis-6.122.1, | ||
75 | 73 | rootdir:·/tmp/tmp.5mj2by8HuS | |
74 | plugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer- | ||
75 | 0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1 | ||
76 | collected·1·item | 76 | collected·1·item |
77 | test_something.py·.······················································[100%] | 77 | test_something.py·.······················································[100%] |
78 | ===============================·inline·snapshot | 78 | ===============================·inline·snapshot |
79 | ================================ | 79 | ================================ |
80 | ───────────────────────────────·Create·snapshots | 80 | ───────────────────────────────·Create·snapshots |
81 | ─────────────────────────────── | 81 | ─────────────────────────────── |
Offset 123, 25 lines modified | Offset 123, 25 lines modified | ||
123 | +------------------------------------------------------------------------------ | 123 | +------------------------------------------------------------------------------ |
124 | + | 124 | + |
125 | These·changes·are·not·applied. | 125 | These·changes·are·not·applied. |
126 | Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with | 126 | Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with |
127 | --inline-snapshot=review | 127 | --inline-snapshot=review |
128 | ==============================·1·passed·in· | 128 | ==============================·1·passed·in·0.90s |
129 | =============================== | 129 | =============================== |
130 | *\x8**\x8**\x8**\x8**\x8*·-\x8--\x8-i\x8in\x8nl\x8li\x8in\x8ne\x8e-\x8-s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t=\x8=s\x8sh\x8ho\x8or\x8rt\x8t-\x8-r\x8re\x8ep\x8po\x8or\x8rt\x8t_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* | 130 | *\x8**\x8**\x8**\x8**\x8*·-\x8--\x8-i\x8in\x8nl\x8li\x8in\x8ne\x8e-\x8-s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t=\x8=s\x8sh\x8ho\x8or\x8rt\x8t-\x8-r\x8re\x8ep\x8po\x8or\x8rt\x8t_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* |
131 | give·a·short·report·over·which·changes·can·be·made·to·the·snapshots | 131 | give·a·short·report·over·which·changes·can·be·made·to·the·snapshots |
132 | >·pytest·test_something.py·--inline-snapshot=short-report | 132 | >·pytest·test_something.py·--inline-snapshot=short-report |
133 | =============================·test·session·starts | 133 | =============================·test·session·starts |
134 | ============================== | 134 | ============================== |
135 | platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 | 135 | platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 |
136 | rootdir:·/tmp/tmp.OOqNQSZyYB | ||
137 | plugins:·time-machine-2.16.0,·mock-3.14.0,·subtests-0.13.1,·hypothesis-6.122.1, | ||
138 | 136 | rootdir:·/tmp/tmp.x4eZJlhZMA | |
137 | plugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer- | ||
138 | 0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1 | ||
139 | collected·1·item | 139 | collected·1·item |
140 | test_something.py·.E·····················································[100%] | 140 | test_something.py·.E·····················································[100%] |
141 | ====================================·ERRORS | 141 | ====================================·ERRORS |
142 | ==================================== | 142 | ==================================== |
143 | _____________________·ERROR·at·teardown·of·test_something | 143 | _____________________·ERROR·at·teardown·of·test_something |
Offset 153, 29 lines modified | Offset 153, 29 lines modified | ||
153 | Error:·one·snapshot·is·missing·a·value·(--inline-snapshot=create) | 153 | Error:·one·snapshot·is·missing·a·value·(--inline-snapshot=create) |
154 | You·can·also·use·--inline-snapshot=review·to·approve·the·changes·interactively | 154 | You·can·also·use·--inline-snapshot=review·to·approve·the·changes·interactively |
155 | ===========================·short·test·summary·info | 155 | ===========================·short·test·summary·info |
156 | ============================ | 156 | ============================ |
157 | ERROR·test_something.py::test_something·-·Failed:·your·snapshot·is·missing·one | 157 | ERROR·test_something.py::test_something·-·Failed:·your·snapshot·is·missing·one |
158 | value. | 158 | value. |
159 | ==========================·1·passed,·1·error·in· | 159 | ==========================·1·passed,·1·error·in·0.86s |
160 | ========================== | 160 | ========================== |
161 | Info | 161 | Info |
162 | short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled | 162 | short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled |
163 | pytest·assert-rewriting.·This·option·will·be·replaced·with·r\x8re\x8ep\x8po\x8or\x8rt\x8t·when·this | 163 | pytest·assert-rewriting.·This·option·will·be·replaced·with·r\x8re\x8ep\x8po\x8or\x8rt\x8t·when·this |
164 | restriction·is·lifted. | 164 | restriction·is·lifted. |
165 | *\x8**\x8**\x8**\x8**\x8*·-\x8--\x8-i\x8in\x8nl\x8li\x8in\x8ne\x8e-\x8-s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t=\x8=r\x8re\x8ep\x8po\x8or\x8rt\x8t_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* | 165 | *\x8**\x8**\x8**\x8**\x8*·-\x8--\x8-i\x8in\x8nl\x8li\x8in\x8ne\x8e-\x8-s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t=\x8=r\x8re\x8ep\x8po\x8or\x8rt\x8t_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* |
166 | Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots | 166 | Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots |
167 | >·pytest·test_something.py·--inline-snapshot=report | 167 | >·pytest·test_something.py·--inline-snapshot=report |
168 | =============================·test·session·starts | 168 | =============================·test·session·starts |
169 | ============================== | 169 | ============================== |
170 | platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 | 170 | platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 |
171 | rootdir:·/tmp/tmp.2EMIjfQ0uz | ||
172 | plugins:·time-machine-2.16.0,·mock-3.14.0,·subtests-0.13.1,·hypothesis-6.122.1, | ||
173 | 171 | rootdir:·/tmp/tmp.pfZBfJqYux | |
172 | plugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer- | ||
173 | 0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1 | ||
174 | collected·1·item | 174 | collected·1·item |
175 | test_something.py·.E·····················································[100%] | 175 | test_something.py·.E·····················································[100%] |
176 | ====================================·ERRORS | 176 | ====================================·ERRORS |
177 | ==================================== | 177 | ==================================== |
178 | _____________________·ERROR·at·teardown·of·test_something | 178 | _____________________·ERROR·at·teardown·of·test_something |
Offset 233, 25 lines modified | Offset 233, 25 lines modified | ||
233 | Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with | 233 | Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with |
234 | --inline-snapshot=review | 234 | --inline-snapshot=review |
235 | ===========================·short·test·summary·info | 235 | ===========================·short·test·summary·info |
236 | ============================ | 236 | ============================ |
237 | ERROR·test_something.py::test_something·-·Failed:·your·snapshot·is·missing·one | 237 | ERROR·test_something.py::test_something·-·Failed:·your·snapshot·is·missing·one |
238 | value. | 238 | value. |
239 | ==========================·1·passed,·1·error·in· | 239 | ==========================·1·passed,·1·error·in·0.86s |
240 | ========================== | 240 | ========================== |
241 | *\x8**\x8**\x8**\x8**\x8*·-\x8--\x8-i\x8in\x8nl\x8li\x8in\x8ne\x8e-\x8-s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t=\x8=r\x8re\x8ev\x8vi\x8ie\x8ew\x8w_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* | 241 | *\x8**\x8**\x8**\x8**\x8*·-\x8--\x8-i\x8in\x8nl\x8li\x8in\x8ne\x8e-\x8-s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t=\x8=r\x8re\x8ev\x8vi\x8ie\x8ew\x8w_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* |
242 | Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes | 242 | Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes |
243 | >·pytest·test_something.py·--inline-snapshot=review | 243 | >·pytest·test_something.py·--inline-snapshot=review |
244 | =============================·test·session·starts | 244 | =============================·test·session·starts |
245 | ============================== | 245 | ============================== |
246 | platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 | 246 | platform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0 |
247 | rootdir:·/tmp/tmp.b1g8Mlp1FF | ||
248 | plugins:·time-machine-2.16.0,·mock-3.14.0,·subtests-0.13.1,·hypothesis-6.122.1, | ||
249 | 247 | rootdir:·/tmp/tmp.lriEsKZIr3 | |
248 | plugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer- | ||
249 | 0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1 | ||
250 | collected·1·item | 250 | collected·1·item |
251 | test_something.py·.······················································[100%] | 251 | test_something.py·.······················································[100%] |
252 | ===============================·inline·snapshot | 252 | ===============================·inline·snapshot |
253 | ================================ | 253 | ================================ |
254 | ───────────────────────────────·Create·snapshots | 254 | ───────────────────────────────·Create·snapshots |
255 | ─────────────────────────────── | 255 | ─────────────────────────────── |
Offset 294, 15 lines modified | Offset 294, 15 lines modified | ||
294 | | | 294 | | |
295 | |·+····assert·2·<=·snapshot(2) | 295 | |·+····assert·2·<=·snapshot(2) |
296 | | | 296 | | |
297 | +------------------------------------------------------------------------------ | 297 | +------------------------------------------------------------------------------ |
298 | + | 298 | + |
299 | do·you·want·to·trim·these·snapshots?·[y/n]·(n): | 299 | do·you·want·to·trim·these·snapshots?·[y/n]·(n): |
300 | ==============================·1·passed·in· | 300 | ==============================·1·passed·in·0.93s |
301 | =============================== | 301 | =============================== |
302 | *\x8**\x8**\x8**\x8**\x8*·-\x8--\x8-i\x8in\x8nl\x8li\x8in\x8ne\x8e-\x8-s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t=\x8=d\x8di\x8is\x8sa\x8ab\x8bl\x8le\x8e_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* | 302 | *\x8**\x8**\x8**\x8**\x8*·-\x8--\x8-i\x8in\x8nl\x8li\x8in\x8ne\x8e-\x8-s\x8sn\x8na\x8ap\x8ps\x8sh\x8ho\x8ot\x8t=\x8=d\x8di\x8is\x8sa\x8ab\x8bl\x8le\x8e_\x8?\x8¶·*\x8**\x8**\x8**\x8**\x8* |
303 | Disables·all·the·snapshot·logic.·snapshot(x)·will·just·return·x.·This·can·be | 303 | Disables·all·the·snapshot·logic.·snapshot(x)·will·just·return·x.·This·can·be |
304 | used·if·you·think·exclude·that·snapshot·logic·causes·a·problem·in·your·tests, | 304 | used·if·you·think·exclude·that·snapshot·logic·causes·a·problem·in·your·tests, |
305 | or·if·you·want·to·speedup·your·CI. | 305 | or·if·you·want·to·speedup·your·CI. |
306 | deprecation | 306 | deprecation |
307 | This·option·was·previously·called·--inline-snapshot-disable | 307 | This·option·was·previously·called·--inline-snapshot-disable |
Offset 742, 25 lines modified | Offset 742, 25 lines modified | ||
742 | ········{ | 742 | ········{ |
743 | ············"location":·"extra.html#inline_snapshot.extra", | 743 | ············"location":·"extra.html#inline_snapshot.extra", |
744 | ············"text":·"<p>The·following·functions·are·build·on·top·of·inline-snapshot·and·could·also·be·implemented·in·an·extra·library.</p>·<p>They·are·part·of·inline-snapshot·because·they·are·general·useful·and·do·not·depend·on·other·libraries.</p>", | 744 | ············"text":·"<p>The·following·functions·are·build·on·top·of·inline-snapshot·and·could·also·be·implemented·in·an·extra·library.</p>·<p>They·are·part·of·inline-snapshot·because·they·are·general·useful·and·do·not·depend·on·other·libraries.</p>", |
745 | ············"title":·"<code>inline_snapshot.extra</code>" | 745 | ············"title":·"<code>inline_snapshot.extra</code>" |
746 | ········}, | 746 | ········}, |
747 | ········{ | 747 | ········{ |
748 | ············"location":·"extra.html#inline_snapshot.extra.prints", | 748 | ············"location":·"extra.html#inline_snapshot.extra.prints", |
749 | ············"text":·"<p>Uses·<code>contextlib.redirect_stderr/stdout</code>·to·capture·the·output·and·compare·it·with·the·snapshots.·<code>dirty_equals.IsStr</code>·can·be·used·to·ignore·the·output·if·needed.</p>·<p>Parameters:</p>·Name·Type·Description·Default·<code>stdout</code>·<code>Snapshot[str]</code>·<p>snapshot·which·is·compared·to·the·recorded·output</p>·<code>''</code>·<code>stderr</code>·<code>Snapshot[str]</code>·<p>snapshot·which·is·compared·to·the·recorded·error·output</p>·<code>''</code>·original--inline-snapshot=createignore·stdout·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·prints\nimport·sys\n\n\ndef·test_prints():\n····with·prints(stdout=snapshot(),·stderr=snapshot()):\n········print(\"hello·world\")\n········print(\"some·error\",·file=sys.stderr)\n</code></pre></p>·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·prints\nimport·sys\n\n\ndef·test_prints():\n····with·prints(\n········stdout=snapshot(\"hello·world\\n\"),·stderr=snapshot(\"some·error\\n\")\n····):\n········print(\"hello·world\")\n········print(\"some·error\",·file=sys.stderr)\n</code></pre></p>·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·prints\nfrom·dirty_equals·import·IsStr\nimport·sys\n\n\ndef·test_prints():\n····with·prints(\n········stdout=IsStr(),\n········stderr=snapshot(\"some·error\\n\"),\n····):\n········print(\"hello·world\")\n········print(\"some·error\",·file=sys.stderr)\n</code></pre></p>·Source·code·in·<code>.pybuild/cpython3_3.1 | 749 | ············"text":·"<p>Uses·<code>contextlib.redirect_stderr/stdout</code>·to·capture·the·output·and·compare·it·with·the·snapshots.·<code>dirty_equals.IsStr</code>·can·be·used·to·ignore·the·output·if·needed.</p>·<p>Parameters:</p>·Name·Type·Description·Default·<code>stdout</code>·<code>Snapshot[str]</code>·<p>snapshot·which·is·compared·to·the·recorded·output</p>·<code>''</code>·<code>stderr</code>·<code>Snapshot[str]</code>·<p>snapshot·which·is·compared·to·the·recorded·error·output</p>·<code>''</code>·original--inline-snapshot=createignore·stdout·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·prints\nimport·sys\n\n\ndef·test_prints():\n····with·prints(stdout=snapshot(),·stderr=snapshot()):\n········print(\"hello·world\")\n········print(\"some·error\",·file=sys.stderr)\n</code></pre></p>·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·prints\nimport·sys\n\n\ndef·test_prints():\n····with·prints(\n········stdout=snapshot(\"hello·world\\n\"),·stderr=snapshot(\"some·error\\n\")\n····):\n········print(\"hello·world\")\n········print(\"some·error\",·file=sys.stderr)\n</code></pre></p>·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·prints\nfrom·dirty_equals·import·IsStr\nimport·sys\n\n\ndef·test_prints():\n····with·prints(\n········stdout=IsStr(),\n········stderr=snapshot(\"some·error\\n\"),\n····):\n········print(\"hello·world\")\n········print(\"some·error\",·file=sys.stderr)\n</code></pre></p>·Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/extra.py</code>·<pre><code>@contextlib.contextmanager\ndef·prints(*,·stdout:·Snapshot[str]·=·\"\",·stderr:·Snapshot[str]·=·\"\"):\n····\"\"\"Uses·`contextlib.redirect_stderr/stdout`·to·capture·the·output·and\n····compare·it·with·the·snapshots.·`dirty_equals.IsStr`·can·be·used·to·ignore\n····the·output·if·needed.\n\n····Parameters:\n········stdout:·snapshot·which·is·compared·to·the·recorded·output\n········stderr:·snapshot·which·is·compared·to·the·recorded·error·output\n\n····===·\"original\"\n\n········<!--·inline-snapshot:·first_block·outcome-passed=1·outcome-errors=1·-->\n········```·python\n········from·inline_snapshot·import·snapshot\n········from·inline_snapshot.extra·import·prints\n········import·sys\n\n\n········def·test_prints():\n············with·prints(stdout=snapshot(),·stderr=snapshot()):\n················print(\"hello·world\")\n················print(\"some·error\",·file=sys.stderr)\n········```\n\n····===·\"--inline-snapshot=create\"\n\n········<!--·inline-snapshot:·create·outcome-passed=1·-->\n········```·python·hl_lines=\"7·8·9\"\n········from·inline_snapshot·import·snapshot\n········from·inline_snapshot.extra·import·prints\n········import·sys\n\n\n········def·test_prints():\n············with·prints(\n················stdout=snapshot(\"hello·world\\\\n\"),·stderr=snapshot(\"some·error\\\\n\")\n············):\n················print(\"hello·world\")\n················print(\"some·error\",·file=sys.stderr)\n········```\n\n····===·\"ignore·stdout\"\n\n········<!--·inline-snapshot:·outcome-passed=1·-->\n········```·python·hl_lines=\"3·9·10\"\n········from·inline_snapshot·import·snapshot\n········from·inline_snapshot.extra·import·prints\n········from·dirty_equals·import·IsStr\n········import·sys\n\n\n········def·test_prints():\n············with·prints(\n················stdout=IsStr(),\n················stderr=snapshot(\"some·error\\\\n\"),\n············):\n················print(\"hello·world\")\n················print(\"some·error\",·file=sys.stderr)\n········```\n····\"\"\"\n\n····with·redirect_stdout(io.StringIO())·as·stdout_io:\n········with·redirect_stderr(io.StringIO())·as·stderr_io:\n············yield\n\n····assert·stderr_io.getvalue()·==·stderr\n····assert·stdout_io.getvalue()·==·stdout\n</code></pre>", |
750 | ············"title":·"<code>prints(*,·stdout='',·stderr='')</code>" | 750 | ············"title":·"<code>prints(*,·stdout='',·stderr='')</code>" |
751 | ········}, | 751 | ········}, |
752 | ········{ | 752 | ········{ |
753 | ············"location":·"extra.html#inline_snapshot.extra.raises", | 753 | ············"location":·"extra.html#inline_snapshot.extra.raises", |
754 | ············"text":·"<p>Check·that·an·exception·is·raised.</p>·<p>Parameters:</p>·Name·Type·Description·Default·<code>exception</code>·<code>Snapshot[str]</code>·<p>snapshot·which·is·compared·with·<code>f\"{type}:·{message}\"</code>·if·an·exception·occured·or·<code>\"<no·exception>\"</code>·if·no·exception·was·raised.</p>·required·original--inline-snapshot=create·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·raises\n\n\ndef·test_raises():\n····with·raises(snapshot()):\n········1·/·0\n</code></pre></p>·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·raises\n\n\ndef·test_raises():\n····with·raises(snapshot(\"ZeroDivisionError:·division·by·zero\")):\n········1·/·0\n</code></pre></p>·Source·code·in·<code>.pybuild/cpython3_3.1 | 754 | ············"text":·"<p>Check·that·an·exception·is·raised.</p>·<p>Parameters:</p>·Name·Type·Description·Default·<code>exception</code>·<code>Snapshot[str]</code>·<p>snapshot·which·is·compared·with·<code>f\"{type}:·{message}\"</code>·if·an·exception·occured·or·<code>\"<no·exception>\"</code>·if·no·exception·was·raised.</p>·required·original--inline-snapshot=create·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·raises\n\n\ndef·test_raises():\n····with·raises(snapshot()):\n········1·/·0\n</code></pre></p>·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·raises\n\n\ndef·test_raises():\n····with·raises(snapshot(\"ZeroDivisionError:·division·by·zero\")):\n········1·/·0\n</code></pre></p>·Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/extra.py</code>·<pre><code>@contextlib.contextmanager\ndef·raises(exception:·Snapshot[str]):\n····\"\"\"Check·that·an·exception·is·raised.\n\n····Parameters:\n········exception:·snapshot·which·is·compared·with·`#!python·f\"{type}:·{message}\"`·if·an·exception·occured·or·`#!python·\"<no·exception>\"`·if·no·exception·was·raised.\n\n····===·\"original\"\n\n········<!--·inline-snapshot:·first_block·outcome-passed=1·outcome-errors=1·-->\n········```·python\n········from·inline_snapshot·import·snapshot\n········from·inline_snapshot.extra·import·raises\n\n\n········def·test_raises():\n············with·raises(snapshot()):\n················1·/·0\n········```\n\n····===·\"--inline-snapshot=create\"\n\n········<!--·inline-snapshot:·create·outcome-passed=1·-->\n········```·python·hl_lines=\"6\"\n········from·inline_snapshot·import·snapshot\n········from·inline_snapshot.extra·import·raises\n\n\n········def·test_raises():\n············with·raises(snapshot(\"ZeroDivisionError:·division·by·zero\")):\n················1·/·0\n········```\n····\"\"\"\n\n····try:\n········yield\n····except·Exception·as·ex:\n········msg·=·str(ex)\n········if·\"\\n\"·in·msg:\n············assert·f\"{type(ex).__name__}:\\n{ex}\"·==·exception\n········else:\n············assert·f\"{type(ex).__name__}:·{ex}\"·==·exception\n····else:\n········assert·\"<no·exception>\"·==·exception\n</code></pre>", |
755 | ············"title":·"<code>raises(exception)</code>" | 755 | ············"title":·"<code>raises(exception)</code>" |
756 | ········}, | 756 | ········}, |
757 | ········{ | 757 | ········{ |
758 | ············"location":·"extra.html#inline_snapshot.extra.warns", | 758 | ············"location":·"extra.html#inline_snapshot.extra.warns", |
759 | ············"text":·"<p>Captures·warnings·with·<code>warnings.catch_warnings</code>·and·compares·them·against·expected·warnings.</p>·<p>Parameters:</p>·Name·Type·Description·Default·<code>expected_warnings</code>·<code>Snapshot[List[Warning]]</code>·<p>Snapshot·containing·a·list·of·expected·warnings.</p>·required·<code>include_line</code>·<code>bool</code>·<p>If·<code>True</code>,·each·expected·warning·is·a·tuple·<code>(linenumber,·message)</code>.</p>·<code>False</code>·<code>include_file</code>·<code>bool</code>·<p>If·<code>True</code>,·each·expected·warning·is·a·tuple·<code>(filename,·message)</code>.</p>·<code>False</code>·<p>The·format·of·the·expected·warning:</p>·<ul>·<li><code>(filename,·linenumber,·message)</code>·if·both·<code>include_line</code>·and·<code>include_file</code>·are·<code>True</code>.</li>·<li><code>(linenumber,·message)</code>·if·only·<code>include_line</code>·is·<code>True</code>.</li>·<li><code>(filename,·message)</code>·if·only·<code>include_file</code>·is·<code>True</code>.</li>·<li>A·string·<code>message</code>·if·both·are·<code>False</code>.</li>·</ul>·original--inline-snapshot=create·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·warns\nfrom·warnings·import·warn\n\n\ndef·test_warns():\n····with·warns(snapshot(),·include_line=True):\n········warn(\"some·problem\")\n</code></pre></p>·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·warns\nfrom·warnings·import·warn\n\n\ndef·test_warns():\n····with·warns(snapshot([(8,·\"UserWarning:·some·problem\")]),·include_line=True):\n········warn(\"some·problem\")\n</code></pre></p>·Source·code·in·<code>.pybuild/cpython3_3.1 | 759 | ············"text":·"<p>Captures·warnings·with·<code>warnings.catch_warnings</code>·and·compares·them·against·expected·warnings.</p>·<p>Parameters:</p>·Name·Type·Description·Default·<code>expected_warnings</code>·<code>Snapshot[List[Warning]]</code>·<p>Snapshot·containing·a·list·of·expected·warnings.</p>·required·<code>include_line</code>·<code>bool</code>·<p>If·<code>True</code>,·each·expected·warning·is·a·tuple·<code>(linenumber,·message)</code>.</p>·<code>False</code>·<code>include_file</code>·<code>bool</code>·<p>If·<code>True</code>,·each·expected·warning·is·a·tuple·<code>(filename,·message)</code>.</p>·<code>False</code>·<p>The·format·of·the·expected·warning:</p>·<ul>·<li><code>(filename,·linenumber,·message)</code>·if·both·<code>include_line</code>·and·<code>include_file</code>·are·<code>True</code>.</li>·<li><code>(linenumber,·message)</code>·if·only·<code>include_line</code>·is·<code>True</code>.</li>·<li><code>(filename,·message)</code>·if·only·<code>include_file</code>·is·<code>True</code>.</li>·<li>A·string·<code>message</code>·if·both·are·<code>False</code>.</li>·</ul>·original--inline-snapshot=create·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·warns\nfrom·warnings·import·warn\n\n\ndef·test_warns():\n····with·warns(snapshot(),·include_line=True):\n········warn(\"some·problem\")\n</code></pre></p>·<p>·<pre><code>from·inline_snapshot·import·snapshot\nfrom·inline_snapshot.extra·import·warns\nfrom·warnings·import·warn\n\n\ndef·test_warns():\n····with·warns(snapshot([(8,·\"UserWarning:·some·problem\")]),·include_line=True):\n········warn(\"some·problem\")\n</code></pre></p>·Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/extra.py</code>·<pre><code>@contextlib.contextmanager\ndef·warns(\n····expected_warnings:·Snapshot[List[Warning]],\n····/,\n····include_line:·bool·=·False,\n····include_file:·bool·=·False,\n):\n····\"\"\"\n····Captures·warnings·with·`warnings.catch_warnings`·and·compares·them·against·expected·warnings.\n\n····Parameters:\n········expected_warnings:·Snapshot·containing·a·list·of·expected·warnings.\n········include_line:·If·`True`,·each·expected·warning·is·a·tuple·`(linenumber,·message)`.\n········include_file:·If·`True`,·each·expected·warning·is·a·tuple·`(filename,·message)`.\n\n····The·format·of·the·expected·warning:\n\n····-·`(filename,·linenumber,·message)`·if·both·`include_line`·and·`include_file`·are·`True`.\n····-·`(linenumber,·message)`·if·only·`include_line`·is·`True`.\n····-·`(filename,·message)`·if·only·`include_file`·is·`True`.\n····-·A·string·`message`·if·both·are·`False`.\n\n····===·\"original\"\n\n········<!--·inline-snapshot:·first_block·outcome-passed=1·outcome-errors=1·-->\n········```·python\n········from·inline_snapshot·import·snapshot\n········from·inline_snapshot.extra·import·warns\n········from·warnings·import·warn\n\n\n········def·test_warns():\n············with·warns(snapshot(),·include_line=True):\n················warn(\"some·problem\")\n········```\n\n····===·\"--inline-snapshot=create\"\n\n········<!--·inline-snapshot:·create·fix·outcome-passed=1·-->\n········```·python·hl_lines=\"7\"\n········from·inline_snapshot·import·snapshot\n········from·inline_snapshot.extra·import·warns\n········from·warnings·import·warn\n\n\n········def·test_warns():\n············with·warns(snapshot([(8,·\"UserWarning:·some·problem\")]),·include_line=True):\n················warn(\"some·problem\")\n········```\n····\"\"\"\n····with·warnings.catch_warnings(record=True)·as·result:\n········warnings.simplefilter(\"always\")\n········yield\n\n····def·make_warning(w):\n········message·=·f\"{w.category.__name__}:·{w.message}\"\n········if·not·include_line·and·not·include_file:\n············return·message\n········message·=·(message,)\n\n········if·include_line:\n············message·=·(w.lineno,·*message)\n········if·include_file:\n············message·=·(w.filename,·*message)\n\n········return·message\n\n····assert·[make_warning(w)·for·w·in·result]·==·expected_warnings\n</code></pre>", |
760 | ············"title":·"<code>warns(expected_warnings,·/,·include_line=False,·include_file=False)</code>" | 760 | ············"title":·"<code>warns(expected_warnings,·/,·include_line=False,·include_file=False)</code>" |
761 | ········}, | 761 | ········}, |
762 | ········{ | 762 | ········{ |
763 | ············"location":·"getitem_snapshot.html", | 763 | ············"location":·"getitem_snapshot.html", |
764 | ············"text":·"", | 764 | ············"text":·"", |
765 | ············"title":·"snapshot()[key]" | 765 | ············"title":·"snapshot()[key]" |
766 | ········}, | 766 | ········}, |
Offset 822, 65 lines modified | Offset 822, 65 lines modified | ||
822 | ········{ | 822 | ········{ |
823 | ············"location":·"outsource.html#api", | 823 | ············"location":·"outsource.html#api", |
824 | ············"text":·"", | 824 | ············"text":·"", |
825 | ············"title":·"API" | 825 | ············"title":·"API" |
826 | ········}, | 826 | ········}, |
827 | ········{ | 827 | ········{ |
828 | ············"location":·"outsource.html#inline_snapshot.outsource", | 828 | ············"location":·"outsource.html#inline_snapshot.outsource", |
829 | ············"text":·"<p>Outsource·some·data·into·an·external·file.</p>·<pre><code>>>>·png_data·=·b\"some_bytes\"··#·should·be·the·replaced·with·your·actual·data\n>>>·outsource(png_data,·suffix=\".png\")\nexternal(\"212974ed1835*.png\")\n</code></pre>·<p>Parameters:</p>·Name·Type·Description·Default·<code>data</code>·<code>Union[str,·bytes]</code>·<p>data·which·should·be·outsourced.·strings·are·encoded·with·<code>\"utf-8\"</code>.</p>·required·<code>suffix</code>·<code>Optional[str]</code>·<p>overwrite·file·suffix.·The·default·is·<code>\".bin\"</code>·if·data·is·an·instance·of·<code>bytes</code>·and·<code>\".txt\"</code>·for·<code>str</code>.</p>·<code>None</code>·<p>Returns:</p>·Type·Description·<code>external</code>·<p>The·external·data.</p>·Source·code·in·<code>.pybuild/cpython3_3.1 | 829 | ············"text":·"<p>Outsource·some·data·into·an·external·file.</p>·<pre><code>>>>·png_data·=·b\"some_bytes\"··#·should·be·the·replaced·with·your·actual·data\n>>>·outsource(png_data,·suffix=\".png\")\nexternal(\"212974ed1835*.png\")\n</code></pre>·<p>Parameters:</p>·Name·Type·Description·Default·<code>data</code>·<code>Union[str,·bytes]</code>·<p>data·which·should·be·outsourced.·strings·are·encoded·with·<code>\"utf-8\"</code>.</p>·required·<code>suffix</code>·<code>Optional[str]</code>·<p>overwrite·file·suffix.·The·default·is·<code>\".bin\"</code>·if·data·is·an·instance·of·<code>bytes</code>·and·<code>\".txt\"</code>·for·<code>str</code>.</p>·<code>None</code>·<p>Returns:</p>·Type·Description·<code>external</code>·<p>The·external·data.</p>·Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code>·<pre><code>def·outsource(data:·Union[str,·bytes],·*,·suffix:·Optional[str]·=·None)·->·external:\n····\"\"\"Outsource·some·data·into·an·external·file.\n\n····```·pycon\n····>>>·png_data·=·b\"some_bytes\"··#·should·be·the·replaced·with·your·actual·data\n····>>>·outsource(png_data,·suffix=\".png\")\n····external(\"212974ed1835*.png\")\n\n····```\n\n····Parameters:\n········data:·data·which·should·be·outsourced.·strings·are·encoded·with·`\"utf-8\"`.\n\n········suffix:·overwrite·file·suffix.·The·default·is·`\".bin\"`·if·data·is·an·instance·of·`#!python·bytes`·and·`\".txt\"`·for·`#!python·str`.\n\n····Returns:\n········The·external·data.\n····\"\"\"\n····if·isinstance(data,·str):\n········data·=·data.encode(\"utf-8\")\n········if·suffix·is·None:\n············suffix·=·\".txt\"\n\n····elif·isinstance(data,·bytes):\n········if·suffix·is·None:\n············suffix·=·\".bin\"\n····else:\n········raise·TypeError(\"data·has·to·be·of·type·bytes·|·str\")\n\n····if·not·suffix·or·suffix[0]·!=·\".\":\n········raise·ValueError(\"suffix·has·to·start·with·a·'.'·like·'.png'\")\n\n····m·=·hashlib.sha256()\n····m.update(data)\n····hash·=·m.hexdigest()\n\n····assert·storage·is·not·None\n\n····name·=·hash·+·suffix\n\n····if·not·storage.lookup_all(name):\n········path·=·hash·+·\"-new\"·+·suffix\n········storage.save(path,·data)\n\n····return·external(name)\n</code></pre>", |
830 | ············"title":·"<code>inline_snapshot.outsource(data,·*,·suffix=None)</code>" | 830 | ············"title":·"<code>inline_snapshot.outsource(data,·*,·suffix=None)</code>" |
831 | ········}, | 831 | ········}, |
832 | ········{ | 832 | ········{ |
833 | ············"location":·"outsource.html#inline_snapshot.external", | 833 | ············"location":·"outsource.html#inline_snapshot.external", |
834 | ············"text":·"Source·code·in·<code>.pybuild/cpython3_3.1 | 834 | ············"text":·"Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code>·<pre><code>class·external:\n····def·__init__(self,·name:·str):\n········\"\"\"External·objects·are·used·as·a·representation·for·outsourced·data.\n········You·should·not·create·them·directly.\n\n········The·external·data·is·by·default·stored·inside·`<pytest_config_dir>/.inline-snapshot/external`,\n········where·`<pytest_config_dir>`·is·replaced·by·the·directory·containing·the·Pytest·configuration·file,·if·any.\n········To·store·data·in·a·different·location,·set·the·`storage-dir`·option·in·pyproject.toml.\n········Data·which·is·outsourced·but·not·referenced·in·the·source·code·jet·has·a·'-new'·suffix·in·the·filename.\n\n········Parameters:\n············name:·the·name·of·the·external·stored·object.\n········\"\"\"\n\n········m·=·re.fullmatch(r\"([0-9a-fA-F]*)\\*?(\\.[a-zA-Z0-9]*)\",·name)\n\n········if·m:\n············self._hash,·self._suffix·=·m.groups()\n········else:\n············raise·ValueError(\n················\"path·has·to·be·of·the·form·<hash>.<suffix>·or·<partial_hash>*.<suffix>\"\n············)\n\n····@property\n····def·_path(self):\n········return·f\"{self._hash}*{self._suffix}\"\n\n····def·__repr__(self):\n········\"\"\"Returns·the·representation·of·the·external·object.\n\n········The·length·of·the·hash·can·be·specified·in·the\n········[config](configuration.md).\n········\"\"\"\n········hash·=·self._hash[:·_config.config.hash_length]\n\n········if·len(hash)·==·64:\n············return·f'external(\"{hash}{self._suffix}\")'\n········else:\n············return·f'external(\"{hash}*{self._suffix}\")'\n\n····def·__eq__(self,·other):\n········\"\"\"Two·external·objects·are·equal·if·they·have·the·same·hash·and\n········suffix.\"\"\"\n········if·not·isinstance(other,·external):\n············return·NotImplemented\n\n········min_hash_len·=·min(len(self._hash),·len(other._hash))\n\n········if·self._hash[:min_hash_len]·!=·other._hash[:min_hash_len]:\n············return·False\n\n········if·self._suffix·!=·other._suffix:\n············return·False\n\n········return·True\n\n····def·_load_value(self):\n········assert·storage·is·not·None\n········return·storage.read(self._path)\n</code></pre>", |
835 | ············"title":·"<code>inline_snapshot.external</code>" | 835 | ············"title":·"<code>inline_snapshot.external</code>" |
836 | ········}, | 836 | ········}, |
837 | ········{ | 837 | ········{ |
838 | ············"location":·"outsource.html#inline_snapshot.external.__eq__", | 838 | ············"location":·"outsource.html#inline_snapshot.external.__eq__", |
839 | ············"text":·"<p>Two·external·objects·are·equal·if·they·have·the·same·hash·and·suffix.</p>·Source·code·in·<code>.pybuild/cpython3_3.1 | 839 | ············"text":·"<p>Two·external·objects·are·equal·if·they·have·the·same·hash·and·suffix.</p>·Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code>·<pre><code>def·__eq__(self,·other):\n····\"\"\"Two·external·objects·are·equal·if·they·have·the·same·hash·and\n····suffix.\"\"\"\n····if·not·isinstance(other,·external):\n········return·NotImplemented\n\n····min_hash_len·=·min(len(self._hash),·len(other._hash))\n\n····if·self._hash[:min_hash_len]·!=·other._hash[:min_hash_len]:\n········return·False\n\n····if·self._suffix·!=·other._suffix:\n········return·False\n\n····return·True\n</code></pre>", |
840 | ············"title":·"<code>__eq__(other)</code>" | 840 | ············"title":·"<code>__eq__(other)</code>" |
841 | ········}, | 841 | ········}, |
842 | ········{ | 842 | ········{ |
843 | ············"location":·"outsource.html#inline_snapshot.external.__init__", | 843 | ············"location":·"outsource.html#inline_snapshot.external.__init__", |
844 | ············"text":·"<p>External·objects·are·used·as·a·representation·for·outsourced·data.·You·should·not·create·them·directly.</p>·<p>The·external·data·is·by·default·stored·inside·<code><pytest_config_dir>/.inline-snapshot/external</code>,·where·<code><pytest_config_dir></code>·is·replaced·by·the·directory·containing·the·Pytest·configuration·file,·if·any.·To·store·data·in·a·different·location,·set·the·<code>storage-dir</code>·option·in·pyproject.toml.·Data·which·is·outsourced·but·not·referenced·in·the·source·code·jet·has·a·'-new'·suffix·in·the·filename.</p>·<p>Parameters:</p>·Name·Type·Description·Default·<code>name</code>·<code>str</code>·<p>the·name·of·the·external·stored·object.</p>·required·Source·code·in·<code>.pybuild/cpython3_3.1 | 844 | ············"text":·"<p>External·objects·are·used·as·a·representation·for·outsourced·data.·You·should·not·create·them·directly.</p>·<p>The·external·data·is·by·default·stored·inside·<code><pytest_config_dir>/.inline-snapshot/external</code>,·where·<code><pytest_config_dir></code>·is·replaced·by·the·directory·containing·the·Pytest·configuration·file,·if·any.·To·store·data·in·a·different·location,·set·the·<code>storage-dir</code>·option·in·pyproject.toml.·Data·which·is·outsourced·but·not·referenced·in·the·source·code·jet·has·a·'-new'·suffix·in·the·filename.</p>·<p>Parameters:</p>·Name·Type·Description·Default·<code>name</code>·<code>str</code>·<p>the·name·of·the·external·stored·object.</p>·required·Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code>·<pre><code>def·__init__(self,·name:·str):\n····\"\"\"External·objects·are·used·as·a·representation·for·outsourced·data.\n····You·should·not·create·them·directly.\n\n····The·external·data·is·by·default·stored·inside·`<pytest_config_dir>/.inline-snapshot/external`,\n····where·`<pytest_config_dir>`·is·replaced·by·the·directory·containing·the·Pytest·configuration·file,·if·any.\n····To·store·data·in·a·different·location,·set·the·`storage-dir`·option·in·pyproject.toml.\n····Data·which·is·outsourced·but·not·referenced·in·the·source·code·jet·has·a·'-new'·suffix·in·the·filename.\n\n····Parameters:\n········name:·the·name·of·the·external·stored·object.\n····\"\"\"\n\n····m·=·re.fullmatch(r\"([0-9a-fA-F]*)\\*?(\\.[a-zA-Z0-9]*)\",·name)\n\n····if·m:\n········self._hash,·self._suffix·=·m.groups()\n····else:\n········raise·ValueError(\n············\"path·has·to·be·of·the·form·<hash>.<suffix>·or·<partial_hash>*.<suffix>\"\n········)\n</code></pre>", |
845 | ············"title":·"<code>__init__(name)</code>" | 845 | ············"title":·"<code>__init__(name)</code>" |
846 | ········}, | 846 | ········}, |
847 | ········{ | 847 | ········{ |
848 | ············"location":·"outsource.html#inline_snapshot.external.__repr__", | 848 | ············"location":·"outsource.html#inline_snapshot.external.__repr__", |
849 | ············"text":·"<p>Returns·the·representation·of·the·external·object.</p>·<p>The·length·of·the·hash·can·be·specified·in·the·config.</p>·Source·code·in·<code>.pybuild/cpython3_3.1 | 849 | ············"text":·"<p>Returns·the·representation·of·the·external·object.</p>·<p>The·length·of·the·hash·can·be·specified·in·the·config.</p>·Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code>·<pre><code>def·__repr__(self):\n····\"\"\"Returns·the·representation·of·the·external·object.\n\n····The·length·of·the·hash·can·be·specified·in·the\n····[config](configuration.md).\n····\"\"\"\n····hash·=·self._hash[:·_config.config.hash_length]\n\n····if·len(hash)·==·64:\n········return·f'external(\"{hash}{self._suffix}\")'\n····else:\n········return·f'external(\"{hash}*{self._suffix}\")'\n</code></pre>", |
850 | ············"title":·"<code>__repr__()</code>" | 850 | ············"title":·"<code>__repr__()</code>" |
851 | ········}, | 851 | ········}, |
852 | ········{ | 852 | ········{ |
853 | ············"location":·"outsource.html#pytest-options", | 853 | ············"location":·"outsource.html#pytest-options", |
854 | ············"text":·"<p>It·interacts·with·the·following·<code>--inline-snapshot</code>·flags:</p>·<ul>·<li><code>trim</code>·removes·every·snapshots·form·the·storage·which·is·not·referenced·with·<code>external(...)</code>·in·the·code.</li>·</ul>", | 854 | ············"text":·"<p>It·interacts·with·the·following·<code>--inline-snapshot</code>·flags:</p>·<ul>·<li><code>trim</code>·removes·every·snapshots·form·the·storage·which·is·not·referenced·with·<code>external(...)</code>·in·the·code.</li>·</ul>", |
855 | ············"title":·"pytest·options" | 855 | ············"title":·"pytest·options" |
856 | ········}, | 856 | ········}, |
857 | ········{ | 857 | ········{ |
858 | ············"location":·"pytest.html", | 858 | ············"location":·"pytest.html", |
859 | ············"text":·"<p>inline-snapshot·provides·one·pytest·option·with·different·flags·(create,·fix,·trim,·update,·short-report,·report,·disable).</p>·<p>Snapshot·comparisons·return·always·<code>True</code>·if·you·use·one·of·the·flags·create,·fix·or·review.·This·is·necessary·because·the·whole·test·needs·to·be·run·to·fix·all·snapshots·like·in·this·case:</p>·<pre><code>from·inline_snapshot·import·snapshot\n\n\ndef·test_something():\n····assert·1·==·snapshot(5)\n····assert·2·<=·snapshot(5)\n</code></pre>·<p>Note</p>·<p>Every·flag·with·the·exception·of·disable·and·short-report·disables·the·pytest·assert-rewriting.</p>", | 859 | ············"text":·"<p>inline-snapshot·provides·one·pytest·option·with·different·flags·(create,·fix,·trim,·update,·short-report,·report,·disable).</p>·<p>Snapshot·comparisons·return·always·<code>True</code>·if·you·use·one·of·the·flags·create,·fix·or·review.·This·is·necessary·because·the·whole·test·needs·to·be·run·to·fix·all·snapshots·like·in·this·case:</p>·<pre><code>from·inline_snapshot·import·snapshot\n\n\ndef·test_something():\n····assert·1·==·snapshot(5)\n····assert·2·<=·snapshot(5)\n</code></pre>·<p>Note</p>·<p>Every·flag·with·the·exception·of·disable·and·short-report·disables·the·pytest·assert-rewriting.</p>", |
860 | ············"title":·"pytest·integration" | 860 | ············"title":·"pytest·integration" |
861 | ········}, | 861 | ········}, |
862 | ········{ | 862 | ········{ |
863 | ············"location":·"pytest.html#-inline-snapshotcreatefixtrimupdate", | 863 | ············"location":·"pytest.html#-inline-snapshotcreatefixtrimupdate", |
864 | ············"text":·"<p>Approve·the·changes·of·the·given·category.·These·flags·can·be·combined·with·report·and·review.</p>·test_something.py<pre><code>from·inline_snapshot·import·snapshot\n\n\ndef·test_something():\n····assert·1·==·snapshot()\n····assert·2·<=·snapshot(5)\n</code></pre>·<pre><code>>·pytest·test_something.py·--inline-snapshot=create,report\n=============================·test·session·starts·==============================\nplatform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0\nrootdir:·/tmp/tmp. | 864 | ············"text":·"<p>Approve·the·changes·of·the·given·category.·These·flags·can·be·combined·with·report·and·review.</p>·test_something.py<pre><code>from·inline_snapshot·import·snapshot\n\n\ndef·test_something():\n····assert·1·==·snapshot()\n····assert·2·<=·snapshot(5)\n</code></pre>·<pre><code>>·pytest·test_something.py·--inline-snapshot=create,report\n=============================·test·session·starts·==============================\nplatform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0\nrootdir:·/tmp/tmp.5mj2by8HuS\nplugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer-0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1\ncollected·1·item\n\ntest_something.py·.······················································[100%]\n[·...·truncated·by·diffoscope;·len:·2705,·SHA:·f0c27dbf4fdd7b45a6c865f2cf4b5bb142318e4bce7ae658cf05cd8e3aae68af·...·]s·===============================\n</code></pre>", |
865 | ············"title":·"--inline-snapshot=create,fix,trim,update" | 865 | ············"title":·"--inline-snapshot=create,fix,trim,update" |
866 | ········}, | 866 | ········}, |
867 | ········{ | 867 | ········{ |
868 | ············"location":·"pytest.html#-inline-snapshotshort-report", | 868 | ············"location":·"pytest.html#-inline-snapshotshort-report", |
869 | ············"text":·"<p>give·a·short·report·over·which·changes·can·be·made·to·the·snapshots</p>·<pre><code>>·pytest·test_something.py·--inline-snapshot=short-report\n=============================·test·session·starts·==============================\nplatform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0\nrootdir:·/tmp/tmp. | 869 | ············"text":·"<p>give·a·short·report·over·which·changes·can·be·made·to·the·snapshots</p>·<pre><code>>·pytest·test_something.py·--inline-snapshot=short-report\n=============================·test·session·starts·==============================\nplatform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0\nrootdir:·/tmp/tmp.x4eZJlhZMA\nplugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer-0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1\ncollected·1·item\n\ntest_something.py·.E·····················································[100%]\n[·...·truncated·by·diffoscope;·len:·715,·SHA:·f30e3d5f0fab1c79586e4e2dc5083d33ca44dc5b96e86097ee724ff4926773cb·...·]s·==========================\n</code></pre>·<p>Info</p>·<p>short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled·pytest·assert-rewriting.·This·option·will·be·replaced·with·report·when·this·restriction·is·lifted.</p>", |
870 | ············"title":·"--inline-snapshot=short-report" | 870 | ············"title":·"--inline-snapshot=short-report" |
871 | ········}, | 871 | ········}, |
872 | ········{ | 872 | ········{ |
873 | ············"location":·"pytest.html#-inline-snapshotreport", | 873 | ············"location":·"pytest.html#-inline-snapshotreport", |
874 | ············"text":·"<p>Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots</p>·<pre><code>>·pytest·test_something.py·--inline-snapshot=report\n=============================·test·session·starts·==============================\nplatform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0\nrootdir:·/tmp/tmp. | 874 | ············"text":·"<p>Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots</p>·<pre><code>>·pytest·test_something.py·--inline-snapshot=report\n=============================·test·session·starts·==============================\nplatform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0\nrootdir:·/tmp/tmp.pfZBfJqYux\nplugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer-0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1\ncollected·1·item\n\ntest_something.py·.E·····················································[100%]\n[·...·truncated·by·diffoscope;·len:·3143,·SHA:·0036c05e06c18b8e356f433b3cd4bbcd2f9fe28504bc48c0f3f079e114eea798·...·]s·==========================\n</code></pre>", |
875 | ············"title":·"--inline-snapshot=report" | 875 | ············"title":·"--inline-snapshot=report" |
876 | ········}, | 876 | ········}, |
877 | ········{ | 877 | ········{ |
878 | ············"location":·"pytest.html#-inline-snapshotreview", | 878 | ············"location":·"pytest.html#-inline-snapshotreview", |
879 | ············"text":·"<p>Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes</p>·<pre><code>>·pytest·test_something.py·--inline-snapshot=review\n=============================·test·session·starts·==============================\nplatform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0\nrootdir:·/tmp/tmp. | 879 | ············"text":·"<p>Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes</p>·<pre><code>>·pytest·test_something.py·--inline-snapshot=review\n=============================·test·session·starts·==============================\nplatform·linux·--·Python·3.12.8,·pytest-8.3.4,·pluggy-1.5.0\nrootdir:·/tmp/tmp.lriEsKZIr3\nplugins:·subtests-0.13.1,·time-machine-2.16.0,·typeguard-4.4.1,·pytest_freezer-0.4.9,·inline-snapshot-0.19.3,·mock-3.14.0,·hypothesis-6.122.1\ncollected·1·item\n\ntest_something.py·.······················································[100%]\n[·...·truncated·by·diffoscope;·len:·2594,·SHA:·be10aa457b8d7c54fbb7505894efa0d98eb023093a120090b676cd98e9d1e36b·...·]s·===============================\n</code></pre>", |
880 | ············"title":·"--inline-snapshot=review" | 880 | ············"title":·"--inline-snapshot=review" |
881 | ········}, | 881 | ········}, |
882 | ········{ | 882 | ········{ |
883 | ············"location":·"pytest.html#-inline-snapshotdisable", | 883 | ············"location":·"pytest.html#-inline-snapshotdisable", |
884 | ············"text":·"<p>Disables·all·the·snapshot·logic.·<code>snapshot(x)</code>·will·just·return·<code>x</code>.·This·can·be·used·if·you·think·exclude·that·snapshot·logic·causes·a·problem·in·your·tests,·or·if·you·want·to·speedup·your·CI.</p>·<p>deprecation</p>·<p>This·option·was·previously·called·<code>--inline-snapshot-disable</code></p>", | 884 | ············"text":·"<p>Disables·all·the·snapshot·logic.·<code>snapshot(x)</code>·will·just·return·<code>x</code>.·This·can·be·used·if·you·think·exclude·that·snapshot·logic·causes·a·problem·in·your·tests,·or·if·you·want·to·speedup·your·CI.</p>·<p>deprecation</p>·<p>This·option·was·previously·called·<code>--inline-snapshot-disable</code></p>", |
885 | ············"title":·"--inline-snapshot=disable" | 885 | ············"title":·"--inline-snapshot=disable" |
886 | ········}, | 886 | ········}, |
Offset 932, 12 lines modified | Offset 932, 12 lines modified | ||
932 | ········{ | 932 | ········{ |
933 | ············"location":·"types.html#inline_snapshot.Category", | 933 | ············"location":·"types.html#inline_snapshot.Category", |
934 | ············"text":·"<p>See·categories</p>", | 934 | ············"text":·"<p>See·categories</p>", |
935 | ············"title":·"<code>Category·=·Literal['update',·'fix',·'create',·'trim']</code>··<code>module-attribute</code>" | 935 | ············"title":·"<code>Category·=·Literal['update',·'fix',·'create',·'trim']</code>··<code>module-attribute</code>" |
936 | ········}, | 936 | ········}, |
937 | ········{ | 937 | ········{ |
938 | ············"location":·"types.html#inline_snapshot.Snapshot", | 938 | ············"location":·"types.html#inline_snapshot.Snapshot", |
939 | ············"text":·"<p>Can·be·used·to·annotate·function·arguments·which·accept·snapshot·values.</p>·<p>You·can·annotate·function·arguments·with·<code>Snapshot[T]</code>·to·declare·that·a·snapshot-value·can·be·passed·as·function·argument.·<code>Snapshot[T]</code>·is·a·type·alias·for·<code>T</code>,·which·allows·you·to·pass·<code>int</code>·values·instead·of·<code>int</code>·snapshots.</p>·<p>Example:</p>·<pre><code>from·typing·import·Optional\nfrom·inline_snapshot·import·snapshot,·Snapshot\n\n#·required·snapshots\n\n\ndef·check_in_bounds(value,·lower:·Snapshot[int],·upper:·Snapshot[int]):\n····assert·lower·<=·value·<=·upper\n\n\ndef·test_numbers():\n····for·c·in·\"hello·world\":\n········check_in_bounds(ord(c),·snapshot(32),·snapshot(119))\n\n····#·use·with·normal·values\n····check_in_bounds(5,·0,·10)\n\n\n#·optional·snapshots\n\n\ndef·check_container(\n····value,\n····*,\n····value_repr:·Optional[Snapshot[str]]·=·None,\n····length:·Optional[Snapshot[int]]·=·None\n):\n····if·value_repr·is·not·None:\n········assert·repr(value)·==·value_repr\n\n····if·length·is·not·None:\n········assert·len(value)·==·length\n\n\ndef·test_container():\n····check_container([1,·2],·value_repr=snapshot(\"[1,·2]\"),·length=snapshot(2))\n\n····check_container({1,·1},·length=snapshot(1))\n</code></pre>·Source·code·in·<code>.pybuild/cpython3_3.1 | 939 | ············"text":·"<p>Can·be·used·to·annotate·function·arguments·which·accept·snapshot·values.</p>·<p>You·can·annotate·function·arguments·with·<code>Snapshot[T]</code>·to·declare·that·a·snapshot-value·can·be·passed·as·function·argument.·<code>Snapshot[T]</code>·is·a·type·alias·for·<code>T</code>,·which·allows·you·to·pass·<code>int</code>·values·instead·of·<code>int</code>·snapshots.</p>·<p>Example:</p>·<pre><code>from·typing·import·Optional\nfrom·inline_snapshot·import·snapshot,·Snapshot\n\n#·required·snapshots\n\n\ndef·check_in_bounds(value,·lower:·Snapshot[int],·upper:·Snapshot[int]):\n····assert·lower·<=·value·<=·upper\n\n\ndef·test_numbers():\n····for·c·in·\"hello·world\":\n········check_in_bounds(ord(c),·snapshot(32),·snapshot(119))\n\n····#·use·with·normal·values\n····check_in_bounds(5,·0,·10)\n\n\n#·optional·snapshots\n\n\ndef·check_container(\n····value,\n····*,\n····value_repr:·Optional[Snapshot[str]]·=·None,\n····length:·Optional[Snapshot[int]]·=·None\n):\n····if·value_repr·is·not·None:\n········assert·repr(value)·==·value_repr\n\n····if·length·is·not·None:\n········assert·len(value)·==·length\n\n\ndef·test_container():\n····check_container([1,·2],·value_repr=snapshot(\"[1,·2]\"),·length=snapshot(2))\n\n····check_container({1,·1},·length=snapshot(1))\n</code></pre>·Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_types.py</code>·<pre><code>class·Snapshot(Generic[T]):\n····\"\"\"Can·be·used·to·annotate·function·arguments·which·accept·snapshot\n····values.\n\n····You·can·annotate·function·arguments·with·`Snapshot[T]`·to·declare·that·a·snapshot-value·can·be·passed·as·function·argument.\n····`Snapshot[T]`·is·a·type·alias·for·`T`,·which·allows·you·to·pass·`int`·values·instead·of·`int`·snapshots.\n\n\n····Example:\n····<!--·inline-snapshot:·create·fix·trim·first_block·outcome-passed=2·-->\n····```·python\n····from·typing·import·Optional\n····from·inline_snapshot·import·snapshot,·Snapshot\n\n····#·required·snapshots\n\n\n····def·check_in_bounds(value,·lower:·Snapshot[int],·upper:·Snapshot[int]):\n········assert·lower·<=·value·<=·upper\n\n\n····def·test_numbers():\n········for·c·in·\"hello·world\":\n············check_in_bounds(ord(c),·snapshot(32),·snapshot(119))\n\n········#·use·with·normal·values\n········check_in_bounds(5,·0,·10)\n\n\n····#·optional·snapshots\n\n\n····def·check_container(\n········value,\n········*,\n········value_repr:·Optional[Snapshot[str]]·=·None,\n········length:·Optional[Snapshot[int]]·=·None\n····):\n········if·value_repr·is·not·None:\n············assert·repr(value)·==·value_repr\n\n········if·length·is·not·None:\n············assert·len(value)·==·length\n\n\n····def·test_container():\n········check_container([1,·2],·value_repr=snapshot(\"[1,·2]\"),·length=snapshot(2))\n\n········check_container({1,·1},·length=snapshot(1))\n····```\n····\"\"\"\n</code></pre>", |
940 | ············"title":·"<code>Snapshot</code>" | 940 | ············"title":·"<code>Snapshot</code>" |
941 | ········} | 941 | ········} |
942 | ····] | 942 | ····] |
943 | } | 943 | } |
Offset 1003, 15 lines modified | Offset 1003, 15 lines modified | ||
1003 | ··············<details·class="quote"> | 1003 | ··············<details·class="quote"> |
1004 | ················<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1004 | ················<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_types.py</code></summary> |
1005 | ················<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-21">21</a></span> | 1005 | ················<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-21">21</a></span> |
1006 | <span·class="normal"><a·href="#__codelineno-0-22">22</a></span> | 1006 | <span·class="normal"><a·href="#__codelineno-0-22">22</a></span> |
1007 | <span·class="normal"><a·href="#__codelineno-0-23">23</a></span> | 1007 | <span·class="normal"><a·href="#__codelineno-0-23">23</a></span> |
1008 | <span·class="normal"><a·href="#__codelineno-0-24">24</a></span> | 1008 | <span·class="normal"><a·href="#__codelineno-0-24">24</a></span> |
1009 | <span·class="normal"><a·href="#__codelineno-0-25">25</a></span> | 1009 | <span·class="normal"><a·href="#__codelineno-0-25">25</a></span> |
1010 | <span·class="normal"><a·href="#__codelineno-0-26">26</a></span> | 1010 | <span·class="normal"><a·href="#__codelineno-0-26">26</a></span> |
1011 | <span·class="normal"><a·href="#__codelineno-0-27">27</a></span> | 1011 | <span·class="normal"><a·href="#__codelineno-0-27">27</a></span> |
Offset 78, 15 lines modified | Offset 78, 15 lines modified | ||
78 | ········assert·len(value)·==·length | 78 | ········assert·len(value)·==·length |
79 | def·test_container(): | 79 | def·test_container(): |
80 | ····check_container([1,·2],·value_repr=snapshot("[1,·2]"),·length=snapshot(2)) | 80 | ····check_container([1,·2],·value_repr=snapshot("[1,·2]"),·length=snapshot(2)) |
81 | ····check_container({1,·1},·length=snapshot(1)) | 81 | ····check_container({1,·1},·length=snapshot(1)) |
82 | Source·code·in·.pybuild/cpython3_3.1 | 82 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
83 | _types.py | 83 | _types.py |
84 | ···class·Snapshot(Generic[T]): | 84 | ···class·Snapshot(Generic[T]): |
85 | _\x82_\x81·····"""Can·be·used·to·annotate·function·arguments·which·accept·snapshot | 85 | _\x82_\x81·····"""Can·be·used·to·annotate·function·arguments·which·accept·snapshot |
86 | _\x82_\x82·····values. | 86 | _\x82_\x82·····values. |
87 | _\x82_\x83 | 87 | _\x82_\x83 |
88 | _\x82_\x84·····You·can·annotate·function·arguments·with·`Snapshot[T]`·to·declare·that·a | 88 | _\x82_\x84·····You·can·annotate·function·arguments·with·`Snapshot[T]`·to·declare·that·a |
89 | _\x82_\x85·snapshot-value·can·be·passed·as·function·argument. | 89 | _\x82_\x85·snapshot-value·can·be·passed·as·function·argument. |