Offset 1, 3 lines modified | Offset 1, 3 lines modified | ||
1 | · | 1 | ·73067a6105986be360a5b5487cc2511f·655932·doc·optional·python-inline-snapshot-doc_0.14.0-2_all.deb |
2 | ·50eecb26435368b0db18a0c41dbfb6b8·28220·python·optional·python3-inline-snapshot_0.14.0-2_all.deb | 2 | ·50eecb26435368b0db18a0c41dbfb6b8·28220·python·optional·python3-inline-snapshot_0.14.0-2_all.deb |
Offset 1, 3 lines modified | Offset 1, 3 lines modified | ||
1 | -rw-r--r--···0········0········0········4·2024-12-04·09:09:58.000000·debian-binary | 1 | -rw-r--r--···0········0········0········4·2024-12-04·09:09:58.000000·debian-binary |
2 | -rw-r--r--···0········0········0·····302 | 2 | -rw-r--r--···0········0········0·····3024·2024-12-04·09:09:58.000000·control.tar.xz |
3 | -rw-r--r--···0········0········0···6527 | 3 | -rw-r--r--···0········0········0···652716·2024-12-04·09:09:58.000000·data.tar.xz |
Offset 1032, 15 lines modified | Offset 1032, 15 lines modified | ||
1032 | <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> | 1032 | <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> |
1033 | </code></pre></div></p> | 1033 | </code></pre></div></p> |
1034 | </div> | 1034 | </div> |
1035 | </div> | 1035 | </div> |
1036 | </div> | 1036 | </div> |
1037 | ············<details·class="quote"> | 1037 | ············<details·class="quote"> |
1038 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1038 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/extra.py</code></summary> |
1039 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-61">·61</a></span> | 1039 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-61">·61</a></span> |
1040 | <span·class="normal"><a·href="#__codelineno-0-62">·62</a></span> | 1040 | <span·class="normal"><a·href="#__codelineno-0-62">·62</a></span> |
1041 | <span·class="normal"><a·href="#__codelineno-0-63">·63</a></span> | 1041 | <span·class="normal"><a·href="#__codelineno-0-63">·63</a></span> |
1042 | <span·class="normal"><a·href="#__codelineno-0-64">·64</a></span> | 1042 | <span·class="normal"><a·href="#__codelineno-0-64">·64</a></span> |
1043 | <span·class="normal"><a·href="#__codelineno-0-65">·65</a></span> | 1043 | <span·class="normal"><a·href="#__codelineno-0-65">·65</a></span> |
1044 | <span·class="normal"><a·href="#__codelineno-0-66">·66</a></span> | 1044 | <span·class="normal"><a·href="#__codelineno-0-66">·66</a></span> |
1045 | <span·class="normal"><a·href="#__codelineno-0-67">·67</a></span> | 1045 | <span·class="normal"><a·href="#__codelineno-0-67">·67</a></span> |
Offset 1245, 15 lines modified | Offset 1245, 15 lines modified | ||
1245 | </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> | 1245 | </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> |
1246 | </code></pre></div></p> | 1246 | </code></pre></div></p> |
1247 | </div> | 1247 | </div> |
1248 | </div> | 1248 | </div> |
1249 | </div> | 1249 | </div> |
1250 | ············<details·class="quote"> | 1250 | ············<details·class="quote"> |
1251 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1251 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/extra.py</code></summary> |
1252 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-15">15</a></span> | 1252 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-15">15</a></span> |
1253 | <span·class="normal"><a·href="#__codelineno-0-16">16</a></span> | 1253 | <span·class="normal"><a·href="#__codelineno-0-16">16</a></span> |
1254 | <span·class="normal"><a·href="#__codelineno-0-17">17</a></span> | 1254 | <span·class="normal"><a·href="#__codelineno-0-17">17</a></span> |
1255 | <span·class="normal"><a·href="#__codelineno-0-18">18</a></span> | 1255 | <span·class="normal"><a·href="#__codelineno-0-18">18</a></span> |
1256 | <span·class="normal"><a·href="#__codelineno-0-19">19</a></span> | 1256 | <span·class="normal"><a·href="#__codelineno-0-19">19</a></span> |
1257 | <span·class="normal"><a·href="#__codelineno-0-20">20</a></span> | 1257 | <span·class="normal"><a·href="#__codelineno-0-20">20</a></span> |
1258 | <span·class="normal"><a·href="#__codelineno-0-21">21</a></span> | 1258 | <span·class="normal"><a·href="#__codelineno-0-21">21</a></span> |
Offset 80, 15 lines modified | Offset 80, 15 lines modified | ||
80 | def·test_prints(): | 80 | def·test_prints(): |
81 | ····with·prints( | 81 | ····with·prints( |
82 | ········stdout=IsStr(), | 82 | ········stdout=IsStr(), |
83 | ········stderr=snapshot("some·error\n"), | 83 | ········stderr=snapshot("some·error\n"), |
84 | ····): | 84 | ····): |
85 | ········print("hello·world") | 85 | ········print("hello·world") |
86 | ········print("some·error",·file=sys.stderr) | 86 | ········print("some·error",·file=sys.stderr) |
87 | Source·code·in·.pybuild/cpython3_3.1 | 87 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
88 | extra.py | 88 | extra.py |
89 | ····@contextlib.contextmanager | 89 | ····@contextlib.contextmanager |
90 | _\x8·_\x86_\x81·def·prints(*,·stdout:·Snapshot[str]·=·"",·stderr:·Snapshot[str]·=·""): | 90 | _\x8·_\x86_\x81·def·prints(*,·stdout:·Snapshot[str]·=·"",·stderr:·Snapshot[str]·=·""): |
91 | _\x8·_\x86_\x82·····"""Uses·`contextlib.redirect_stderr/stdout`·to·capture·the·output·and | 91 | _\x8·_\x86_\x82·····"""Uses·`contextlib.redirect_stderr/stdout`·to·capture·the·output·and |
92 | _\x8·_\x86_\x83·····compare·it·with·the·snapshots.·`dirty_equals.IsStr`·can·be·used·to | 92 | _\x8·_\x86_\x83·····compare·it·with·the·snapshots.·`dirty_equals.IsStr`·can·be·used·to |
93 | _\x8·_\x86_\x84·ignore | 93 | _\x8·_\x86_\x84·ignore |
94 | _\x8·_\x86_\x85·····the·output·if·needed. | 94 | _\x8·_\x86_\x85·····the·output·if·needed. |
Offset 176, 15 lines modified | Offset 176, 15 lines modified | ||
176 | from·inline_snapshot·import·snapshot | 176 | from·inline_snapshot·import·snapshot |
177 | from·inline_snapshot.extra·import·raises | 177 | from·inline_snapshot.extra·import·raises |
178 | def·test_raises(): | 178 | def·test_raises(): |
179 | ····with·raises(snapshot("ZeroDivisionError:·division·by·zero")): | 179 | ····with·raises(snapshot("ZeroDivisionError:·division·by·zero")): |
180 | ········1·/·0 | 180 | ········1·/·0 |
181 | Source·code·in·.pybuild/cpython3_3.1 | 181 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
182 | extra.py | 182 | extra.py |
183 | ···@contextlib.contextmanager | 183 | ···@contextlib.contextmanager |
184 | _\x81_\x85·def·raises(exception:·Snapshot[str]): | 184 | _\x81_\x85·def·raises(exception:·Snapshot[str]): |
185 | _\x81_\x86·····"""Check·that·an·exception·is·raised. | 185 | _\x81_\x86·····"""Check·that·an·exception·is·raised. |
186 | _\x81_\x87 | 186 | _\x81_\x87 |
187 | _\x81_\x88·····Parameters: | 187 | _\x81_\x88·····Parameters: |
188 | _\x81_\x89·········exception:·snapshot·which·is·compared·with·`#!python·f"{type}: | 188 | _\x81_\x89·········exception:·snapshot·which·is·compared·with·`#!python·f"{type}: |
Offset 1157, 15 lines modified | Offset 1157, 15 lines modified | ||
1157 | ··············</div> | 1157 | ··············</div> |
1158 | ············</td> | 1158 | ············</td> |
1159 | ··········</tr> | 1159 | ··········</tr> |
1160 | ······</tbody> | 1160 | ······</tbody> |
1161 | ····</table> | 1161 | ····</table> |
1162 | ············<details·class="quote"> | 1162 | ············<details·class="quote"> |
1163 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1163 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1164 | ··············<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> | 1164 | ··············<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> |
1165 | <span·class="normal"><a·href="#__codelineno-0-137">137</a></span> | 1165 | <span·class="normal"><a·href="#__codelineno-0-137">137</a></span> |
1166 | <span·class="normal"><a·href="#__codelineno-0-138">138</a></span> | 1166 | <span·class="normal"><a·href="#__codelineno-0-138">138</a></span> |
1167 | <span·class="normal"><a·href="#__codelineno-0-139">139</a></span> | 1167 | <span·class="normal"><a·href="#__codelineno-0-139">139</a></span> |
1168 | <span·class="normal"><a·href="#__codelineno-0-140">140</a></span> | 1168 | <span·class="normal"><a·href="#__codelineno-0-140">140</a></span> |
1169 | <span·class="normal"><a·href="#__codelineno-0-141">141</a></span> | 1169 | <span·class="normal"><a·href="#__codelineno-0-141">141</a></span> |
1170 | <span·class="normal"><a·href="#__codelineno-0-142">142</a></span> | 1170 | <span·class="normal"><a·href="#__codelineno-0-142">142</a></span> |
Offset 1273, 15 lines modified | Offset 1273, 15 lines modified | ||
1273 | ··············<details·class="quote"> | 1273 | ··············<details·class="quote"> |
1274 | ················<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1274 | ················<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1275 | ················<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> | 1275 | ················<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> |
1276 | <span·class="normal"><a·href="#__codelineno-0-77">·77</a></span> | 1276 | <span·class="normal"><a·href="#__codelineno-0-77">·77</a></span> |
1277 | <span·class="normal"><a·href="#__codelineno-0-78">·78</a></span> | 1277 | <span·class="normal"><a·href="#__codelineno-0-78">·78</a></span> |
1278 | <span·class="normal"><a·href="#__codelineno-0-79">·79</a></span> | 1278 | <span·class="normal"><a·href="#__codelineno-0-79">·79</a></span> |
1279 | <span·class="normal"><a·href="#__codelineno-0-80">·80</a></span> | 1279 | <span·class="normal"><a·href="#__codelineno-0-80">·80</a></span> |
1280 | <span·class="normal"><a·href="#__codelineno-0-81">·81</a></span> | 1280 | <span·class="normal"><a·href="#__codelineno-0-81">·81</a></span> |
1281 | <span·class="normal"><a·href="#__codelineno-0-82">·82</a></span> | 1281 | <span·class="normal"><a·href="#__codelineno-0-82">·82</a></span> |
Offset 1419, 15 lines modified | Offset 1419, 15 lines modified | ||
1419 | ····<div·class="doc·doc-contents·"> | 1419 | ····<div·class="doc·doc-contents·"> |
1420 | ········<p>Two·external·objects·are·equal·if·they·have·the·same·hash·and | 1420 | ········<p>Two·external·objects·are·equal·if·they·have·the·same·hash·and |
1421 | suffix.</p> | 1421 | suffix.</p> |
1422 | ············<details·class="quote"> | 1422 | ············<details·class="quote"> |
1423 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1423 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1424 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-115">115</a></span> | 1424 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-115">115</a></span> |
1425 | <span·class="normal"><a·href="#__codelineno-0-116">116</a></span> | 1425 | <span·class="normal"><a·href="#__codelineno-0-116">116</a></span> |
1426 | <span·class="normal"><a·href="#__codelineno-0-117">117</a></span> | 1426 | <span·class="normal"><a·href="#__codelineno-0-117">117</a></span> |
1427 | <span·class="normal"><a·href="#__codelineno-0-118">118</a></span> | 1427 | <span·class="normal"><a·href="#__codelineno-0-118">118</a></span> |
1428 | <span·class="normal"><a·href="#__codelineno-0-119">119</a></span> | 1428 | <span·class="normal"><a·href="#__codelineno-0-119">119</a></span> |
1429 | <span·class="normal"><a·href="#__codelineno-0-120">120</a></span> | 1429 | <span·class="normal"><a·href="#__codelineno-0-120">120</a></span> |
1430 | <span·class="normal"><a·href="#__codelineno-0-121">121</a></span> | 1430 | <span·class="normal"><a·href="#__codelineno-0-121">121</a></span> |
Offset 1504, 15 lines modified | Offset 1504, 15 lines modified | ||
1504 | ················<em>required</em> | 1504 | ················<em>required</em> |
1505 | ············</td> | 1505 | ············</td> |
1506 | ··········</tr> | 1506 | ··········</tr> |
1507 | ······</tbody> | 1507 | ······</tbody> |
1508 | ····</table> | 1508 | ····</table> |
1509 | ············<details·class="quote"> | 1509 | ············<details·class="quote"> |
1510 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1510 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1511 | ··············<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> | 1511 | ··············<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> |
1512 | <span·class="normal"><a·href="#__codelineno-0-78">78</a></span> | 1512 | <span·class="normal"><a·href="#__codelineno-0-78">78</a></span> |
1513 | <span·class="normal"><a·href="#__codelineno-0-79">79</a></span> | 1513 | <span·class="normal"><a·href="#__codelineno-0-79">79</a></span> |
1514 | <span·class="normal"><a·href="#__codelineno-0-80">80</a></span> | 1514 | <span·class="normal"><a·href="#__codelineno-0-80">80</a></span> |
1515 | <span·class="normal"><a·href="#__codelineno-0-81">81</a></span> | 1515 | <span·class="normal"><a·href="#__codelineno-0-81">81</a></span> |
1516 | <span·class="normal"><a·href="#__codelineno-0-82">82</a></span> | 1516 | <span·class="normal"><a·href="#__codelineno-0-82">82</a></span> |
1517 | <span·class="normal"><a·href="#__codelineno-0-83">83</a></span> | 1517 | <span·class="normal"><a·href="#__codelineno-0-83">83</a></span> |
Offset 1566, 15 lines modified | Offset 1566, 15 lines modified | ||
1566 | ····<div·class="doc·doc-contents·"> | 1566 | ····<div·class="doc·doc-contents·"> |
1567 | ········<p>Returns·the·representation·of·the·external·object.</p> | 1567 | ········<p>Returns·the·representation·of·the·external·object.</p> |
1568 | <p>The·length·of·the·hash·can·be·specified·in·the | 1568 | <p>The·length·of·the·hash·can·be·specified·in·the |
1569 | <a·href="configuration.html">config</a>.</p> | 1569 | <a·href="configuration.html">config</a>.</p> |
1570 | ············<details·class="quote"> | 1570 | ············<details·class="quote"> |
1571 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1571 | ··············<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_external.py</code></summary> |
1572 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-102">102</a></span> | 1572 | ··············<div·class="highlight"><table·class="highlighttable"><tr><td·class="linenos"><div·class="linenodiv"><pre><span></span><span·class="normal"><a·href="#__codelineno-0-102">102</a></span> |
1573 | <span·class="normal"><a·href="#__codelineno-0-103">103</a></span> | 1573 | <span·class="normal"><a·href="#__codelineno-0-103">103</a></span> |
1574 | <span·class="normal"><a·href="#__codelineno-0-104">104</a></span> | 1574 | <span·class="normal"><a·href="#__codelineno-0-104">104</a></span> |
1575 | <span·class="normal"><a·href="#__codelineno-0-105">105</a></span> | 1575 | <span·class="normal"><a·href="#__codelineno-0-105">105</a></span> |
1576 | <span·class="normal"><a·href="#__codelineno-0-106">106</a></span> | 1576 | <span·class="normal"><a·href="#__codelineno-0-106">106</a></span> |
1577 | <span·class="normal"><a·href="#__codelineno-0-107">107</a></span> | 1577 | <span·class="normal"><a·href="#__codelineno-0-107">107</a></span> |
1578 | <span·class="normal"><a·href="#__codelineno-0-108">108</a></span> | 1578 | <span·class="normal"><a·href="#__codelineno-0-108">108</a></span> |
Offset 105, 15 lines modified | Offset 105, 15 lines modified | ||
105 | ·························encoded·with·"utf-8". | 105 | ·························encoded·with·"utf-8". |
106 | ·························overwrite·file·suffix.·The·default·is·".bin" | 106 | ·························overwrite·file·suffix.·The·default·is·".bin" |
107 | suffix·Optional[str]·····if·data·is·an·instance·of·bytes·and·".txt"···None | 107 | suffix·Optional[str]·····if·data·is·an·instance·of·bytes·and·".txt"···None |
108 | ·························for·str. | 108 | ·························for·str. |
109 | Returns: | 109 | Returns: |
110 | T\x8Ty\x8yp\x8pe\x8e·····D\x8De\x8es\x8sc\x8cr\x8ri\x8ip\x8pt\x8ti\x8io\x8on\x8n | 110 | T\x8Ty\x8yp\x8pe\x8e·····D\x8De\x8es\x8sc\x8cr\x8ri\x8ip\x8pt\x8ti\x8io\x8on\x8n |
111 | _\x8e_\x8x_\x8t_\x8e_\x8r_\x8n_\x8a_\x8l·The·external·data. | 111 | _\x8e_\x8x_\x8t_\x8e_\x8r_\x8n_\x8a_\x8l·The·external·data. |
112 | Source·code·in·.pybuild/cpython3_3.1 | 112 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
113 | _external.py | 113 | _external.py |
114 | ····def·outsource(data:·Union[str,·bytes],·*,·suffix:·Optional[str]·=·None)·- | 114 | ····def·outsource(data:·Union[str,·bytes],·*,·suffix:·Optional[str]·=·None)·- |
115 | ····>·external: | 115 | ····>·external: |
116 | _\x81_\x83_\x86·····"""Outsource·some·data·into·an·external·file. | 116 | _\x81_\x83_\x86·····"""Outsource·some·data·into·an·external·file. |
117 | _\x81_\x83_\x87 | 117 | _\x81_\x83_\x87 |
118 | _\x81_\x83_\x88·····```·pycon | 118 | _\x81_\x83_\x88·····```·pycon |
119 | _\x81_\x83_\x89·····>>>·png_data·=·b"some_bytes"··#·should·be·the·replaced·with·your·actual | 119 | _\x81_\x83_\x89·····>>>·png_data·=·b"some_bytes"··#·should·be·the·replaced·with·your·actual |
Offset 157, 15 lines modified | Offset 157, 15 lines modified | ||
157 | _\x81_\x87_\x87 | 157 | _\x81_\x87_\x87 |
158 | _\x81_\x87_\x88·····if·not·storage.lookup_all(name): | 158 | _\x81_\x87_\x88·····if·not·storage.lookup_all(name): |
159 | _\x81_\x87_\x89·········path·=·hash·+·"-new"·+·suffix | 159 | _\x81_\x87_\x89·········path·=·hash·+·"-new"·+·suffix |
160 | _\x81_\x88_\x80·········storage.save(path,·data) | 160 | _\x81_\x88_\x80·········storage.save(path,·data) |
161 | ········return·external(name) | 161 | ········return·external(name) |
162 | 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¶ | 162 | 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¶ |
163 | Source·code·in·.pybuild/cpython3_3.1 | 163 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
164 | _external.py | 164 | _external.py |
165 | ····class·external: | 165 | ····class·external: |
166 | ········def·__init__(self,·name:·str): | 166 | ········def·__init__(self,·name:·str): |
167 | _\x8·_\x87_\x86·········"""External·objects·are·used·as·a·representation·for·outsourced | 167 | _\x8·_\x87_\x86·········"""External·objects·are·used·as·a·representation·for·outsourced |
168 | _\x8·_\x87_\x87·data. | 168 | _\x8·_\x87_\x87·data. |
169 | _\x8·_\x87_\x88·········You·should·not·create·them·directly. | 169 | _\x8·_\x87_\x88·········You·should·not·create·them·directly. |
170 | _\x8·_\x87_\x89 | 170 | _\x8·_\x87_\x89 |
Offset 224, 15 lines modified | Offset 224, 15 lines modified | ||
224 | _\x81_\x83_\x82·········return·True | 224 | _\x81_\x83_\x82·········return·True |
225 | _\x81_\x83_\x83 | 225 | _\x81_\x83_\x83 |
226 | ········def·_load_value(self): | 226 | ········def·_load_value(self): |
227 | ············assert·storage·is·not·None | 227 | ············assert·storage·is·not·None |
228 | ············return·storage.read(self._path) | 228 | ············return·storage.read(self._path) |
229 | _\x8__\x8_e\x8eq\x8q_\x8__\x8_(\x8(o\x8ot\x8th\x8he\x8er\x8r)\x8)·_\x8?\x8¶ | 229 | _\x8__\x8_e\x8eq\x8q_\x8__\x8_(\x8(o\x8ot\x8th\x8he\x8er\x8r)\x8)·_\x8?\x8¶ |
230 | Two·external·objects·are·equal·if·they·have·the·same·hash·and·suffix. | 230 | Two·external·objects·are·equal·if·they·have·the·same·hash·and·suffix. |
231 | Source·code·in·.pybuild/cpython3_3.1 | 231 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
232 | _external.py | 232 | _external.py |
233 | _\x81_\x81_\x85·def·__eq__(self,·other): | 233 | _\x81_\x81_\x85·def·__eq__(self,·other): |
234 | _\x81_\x81_\x86·····"""Two·external·objects·are·equal·if·they·have·the·same·hash·and | 234 | _\x81_\x81_\x86·····"""Two·external·objects·are·equal·if·they·have·the·same·hash·and |
235 | _\x81_\x81_\x87·····suffix.""" | 235 | _\x81_\x81_\x87·····suffix.""" |
236 | _\x81_\x81_\x88·····if·not·isinstance(other,·external): | 236 | _\x81_\x81_\x88·····if·not·isinstance(other,·external): |
237 | _\x81_\x81_\x89·········return·NotImplemented | 237 | _\x81_\x81_\x89·········return·NotImplemented |
238 | _\x81_\x82_\x80 | 238 | _\x81_\x82_\x80 |
Offset 251, 15 lines modified | Offset 251, 15 lines modified | ||
251 | The·external·data·is·stored·inside·<pytest_config_dir>/.inline_snapshot/ | 251 | The·external·data·is·stored·inside·<pytest_config_dir>/.inline_snapshot/ |
252 | external,·where·<pytest_config_dir>·is·replaced·by·the·directory·containing·the | 252 | external,·where·<pytest_config_dir>·is·replaced·by·the·directory·containing·the |
253 | Pytest·configuration·file,·if·any.·Data·which·is·outsourced·but·not·referenced | 253 | Pytest·configuration·file,·if·any.·Data·which·is·outsourced·but·not·referenced |
254 | in·the·source·code·jet·has·a·'-new'·suffix·in·the·filename. | 254 | in·the·source·code·jet·has·a·'-new'·suffix·in·the·filename. |
255 | Parameters: | 255 | Parameters: |
256 | 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 | 256 | 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 |
257 | name·str··the·name·of·the·external·stored·object.·r\x8re\x8eq\x8qu\x8ui\x8ir\x8re\x8ed\x8d | 257 | name·str··the·name·of·the·external·stored·object.·r\x8re\x8eq\x8qu\x8ui\x8ir\x8re\x8ed\x8d |
258 | Source·code·in·.pybuild/cpython3_3.1 | 258 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
259 | _external.py | 259 | _external.py |
260 | ···def·__init__(self,·name:·str): | 260 | ···def·__init__(self,·name:·str): |
261 | ·······"""External·objects·are·used·as·a·representation·for·outsourced·data. | 261 | ·······"""External·objects·are·used·as·a·representation·for·outsourced·data. |
262 | _\x87_\x87·····You·should·not·create·them·directly. | 262 | _\x87_\x87·····You·should·not·create·them·directly. |
263 | _\x87_\x88 | 263 | _\x87_\x88 |
264 | _\x87_\x89·····The·external·data·is·stored·inside | 264 | _\x87_\x89·····The·external·data·is·stored·inside |
265 | _\x88_\x80·`<pytest_config_dir>/.inline_snapshot/external`, | 265 | _\x88_\x80·`<pytest_config_dir>/.inline_snapshot/external`, |
Offset 280, 15 lines modified | Offset 280, 15 lines modified | ||
280 | _\x89_\x85·········raise·ValueError( | 280 | _\x89_\x85·········raise·ValueError( |
281 | _\x89_\x86·············"path·has·to·be·of·the·form·<hash>.<suffix>·or | 281 | _\x89_\x86·············"path·has·to·be·of·the·form·<hash>.<suffix>·or |
282 | ···<partial_hash>*.<suffix>" | 282 | ···<partial_hash>*.<suffix>" |
283 | ···········) | 283 | ···········) |
284 | _\x8__\x8_r\x8re\x8ep\x8pr\x8r_\x8__\x8_(\x8()\x8)·_\x8?\x8¶ | 284 | _\x8__\x8_r\x8re\x8ep\x8pr\x8r_\x8__\x8_(\x8()\x8)·_\x8?\x8¶ |
285 | Returns·the·representation·of·the·external·object. | 285 | Returns·the·representation·of·the·external·object. |
286 | The·length·of·the·hash·can·be·specified·in·the·_\x8c_\x8o_\x8n_\x8f_\x8i_\x8g. | 286 | The·length·of·the·hash·can·be·specified·in·the·_\x8c_\x8o_\x8n_\x8f_\x8i_\x8g. |
287 | Source·code·in·.pybuild/cpython3_3.1 | 287 | Source·code·in·.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/ |
288 | _external.py | 288 | _external.py |
289 | _\x81_\x80_\x82·def·__repr__(self): | 289 | _\x81_\x80_\x82·def·__repr__(self): |
290 | _\x81_\x80_\x83·····"""Returns·the·representation·of·the·external·object. | 290 | _\x81_\x80_\x83·····"""Returns·the·representation·of·the·external·object. |
291 | _\x81_\x80_\x84 | 291 | _\x81_\x80_\x84 |
292 | _\x81_\x80_\x85·····The·length·of·the·hash·can·be·specified·in·the | 292 | _\x81_\x80_\x85·····The·length·of·the·hash·can·be·specified·in·the |
293 | _\x81_\x80_\x86·····[config](configuration.md). | 293 | _\x81_\x80_\x86·····[config](configuration.md). |
294 | _\x81_\x80_\x87·····""" | 294 | _\x81_\x80_\x87·····""" |
Offset 967, 16 lines modified | Offset 967, 16 lines modified | ||
967 | <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> | 967 | <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> |
968 | <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> | 968 | <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> |
969 | <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> | 969 | <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> |
970 | </code></pre></div> | 970 | </code></pre></div> |
971 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a>\x1b[1;34m>·pytest·test_something.py·--inline-snapshot=create,report | 971 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a>\x1b[1;34m>·pytest·test_something.py·--inline-snapshot=create,report |
972 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a>\x1b[0m\x1b[1m=============================·test·session·starts·==============================\x1b[0m | 972 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a>\x1b[0m\x1b[1m=============================·test·session·starts·==============================\x1b[0m |
973 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 | 973 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 |
974 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp. | 974 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp.I8WaL3lfzW |
975 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:· | 975 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1,·pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1 |
976 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item | 976 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item |
977 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> | 977 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> |
978 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·\x1b[32m.\x1b[0m\x1b[32m······················································[100%]\x1b[0m | 978 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·\x1b[32m.\x1b[0m\x1b[32m······················································[100%]\x1b[0m |
979 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a>===============================·inline·snapshot·================================ | 979 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a>===============================·inline·snapshot·================================ |
980 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>───────────────────────────────·Create·snapshots·─────────────────────────────── | 980 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>───────────────────────────────·Create·snapshots·─────────────────────────────── |
981 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>+-----------------------------·test_something.py·------------------------------+ | 981 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>+-----------------------------·test_something.py·------------------------------+ |
982 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>|·@@·-2,5·+2,5·@@······························································| | 982 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>|·@@·-2,5·+2,5·@@······························································| |
Offset 1001, 51 lines modified | Offset 1001, 51 lines modified | ||
1001 | <a·id="__codelineno-0-31"·name="__codelineno-0-31"·href="#__codelineno-0-31"></a>|·+····assert·2·<=·snapshot(2)·················································| | 1001 | <a·id="__codelineno-0-31"·name="__codelineno-0-31"·href="#__codelineno-0-31"></a>|·+····assert·2·<=·snapshot(2)·················································| |
1002 | <a·id="__codelineno-0-32"·name="__codelineno-0-32"·href="#__codelineno-0-32"></a>+------------------------------------------------------------------------------+ | 1002 | <a·id="__codelineno-0-32"·name="__codelineno-0-32"·href="#__codelineno-0-32"></a>+------------------------------------------------------------------------------+ |
1003 | <a·id="__codelineno-0-33"·name="__codelineno-0-33"·href="#__codelineno-0-33"></a>These·changes·are·not·applied. | 1003 | <a·id="__codelineno-0-33"·name="__codelineno-0-33"·href="#__codelineno-0-33"></a>These·changes·are·not·applied. |
1004 | <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· | 1004 | <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· |
1005 | <a·id="__codelineno-0-35"·name="__codelineno-0-35"·href="#__codelineno-0-35"></a>--inline-snapshot=review | 1005 | <a·id="__codelineno-0-35"·name="__codelineno-0-35"·href="#__codelineno-0-35"></a>--inline-snapshot=review |
1006 | <a·id="__codelineno-0-36"·name="__codelineno-0-36"·href="#__codelineno-0-36"></a> | 1006 | <a·id="__codelineno-0-36"·name="__codelineno-0-36"·href="#__codelineno-0-36"></a> |
1007 | <a·id="__codelineno-0-37"·name="__codelineno-0-37"·href="#__codelineno-0-37"></a> | 1007 | <a·id="__codelineno-0-37"·name="__codelineno-0-37"·href="#__codelineno-0-37"></a> |
1008 | <a·id="__codelineno-0-38"·name="__codelineno-0-38"·href="#__codelineno-0-38"></a>\x1b[32m==============================·\x1b[32m\x1b[1m1·passed\x1b[0m\x1b[32m·in·0. | 1008 | <a·id="__codelineno-0-38"·name="__codelineno-0-38"·href="#__codelineno-0-38"></a>\x1b[32m==============================·\x1b[32m\x1b[1m1·passed\x1b[0m\x1b[32m·in·0.98s\x1b[0m\x1b[32m·===============================\x1b[0m |
1009 | </code></pre></div> | 1009 | </code></pre></div> |
1010 | <h2·id="-inline-snapshotshort-report">--inline-snapshot=short-report<a·class="headerlink"·href="#-inline-snapshotshort-report"·title="Permanent·link">¶</a></h2> | 1010 | <h2·id="-inline-snapshotshort-report">--inline-snapshot=short-report<a·class="headerlink"·href="#-inline-snapshotshort-report"·title="Permanent·link">¶</a></h2> |
1011 | <p>give·a·short·report·over·which·changes·can·be·made·to·the·snapshots</p> | 1011 | <p>give·a·short·report·over·which·changes·can·be·made·to·the·snapshots</p> |
1012 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a>\x1b[1;34m>·pytest·test_something.py·--inline-snapshot=short-report | 1012 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a>\x1b[1;34m>·pytest·test_something.py·--inline-snapshot=short-report |
1013 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a>\x1b[0m\x1b[1m=============================·test·session·starts·==============================\x1b[0m | 1013 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a>\x1b[0m\x1b[1m=============================·test·session·starts·==============================\x1b[0m |
1014 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 | 1014 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 |
1015 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp. | 1015 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp.w45CMeENlp |
1016 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:· | 1016 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1,·pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1 |
1017 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item | 1017 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item |
1018 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> | 1018 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> |
1019 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·\x1b[32m.\x1b[0m\x1b[31mE\x1b[0m\x1b[31m·····················································[100%]\x1b[0m | 1019 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·\x1b[32m.\x1b[0m\x1b[31mE\x1b[0m\x1b[31m·····················································[100%]\x1b[0m |
1020 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a> | 1020 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a> |
1021 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>====================================·ERRORS·==================================== | 1021 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>====================================·ERRORS·==================================== |
1022 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>\x1b[31m\x1b[1m_____________________·ERROR·at·teardown·of·test_something·______________________\x1b[0m | 1022 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>\x1b[31m\x1b[1m_____________________·ERROR·at·teardown·of·test_something·______________________\x1b[0m |
1023 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>\x1b[0myour·snapshot·\x1b[95mis\x1b[39;49;00m·missing·one·value.\x1b[90m\x1b[39;49;00m | 1023 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>\x1b[0myour·snapshot·\x1b[95mis\x1b[39;49;00m·missing·one·value.\x1b[90m\x1b[39;49;00m |
1024 | <a·id="__codelineno-0-13"·name="__codelineno-0-13"·href="#__codelineno-0-13"></a>===============================·inline·snapshot·================================ | 1024 | <a·id="__codelineno-0-13"·name="__codelineno-0-13"·href="#__codelineno-0-13"></a>===============================·inline·snapshot·================================ |
1025 | <a·id="__codelineno-0-14"·name="__codelineno-0-14"·href="#__codelineno-0-14"></a>Info:·one·snapshot·can·be·trimmed·(--inline-snapshot=trim) | 1025 | <a·id="__codelineno-0-14"·name="__codelineno-0-14"·href="#__codelineno-0-14"></a>Info:·one·snapshot·can·be·trimmed·(--inline-snapshot=trim) |
1026 | <a·id="__codelineno-0-15"·name="__codelineno-0-15"·href="#__codelineno-0-15"></a>Error:·one·snapshot·is·missing·a·value·(--inline-snapshot=create) | 1026 | <a·id="__codelineno-0-15"·name="__codelineno-0-15"·href="#__codelineno-0-15"></a>Error:·one·snapshot·is·missing·a·value·(--inline-snapshot=create) |
1027 | <a·id="__codelineno-0-16"·name="__codelineno-0-16"·href="#__codelineno-0-16"></a> | 1027 | <a·id="__codelineno-0-16"·name="__codelineno-0-16"·href="#__codelineno-0-16"></a> |
1028 | <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 | 1028 | <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 |
1029 | <a·id="__codelineno-0-18"·name="__codelineno-0-18"·href="#__codelineno-0-18"></a>\x1b[36m\x1b[1m===========================·short·test·summary·info·============================\x1b[0m | 1029 | <a·id="__codelineno-0-18"·name="__codelineno-0-18"·href="#__codelineno-0-18"></a>\x1b[36m\x1b[1m===========================·short·test·summary·info·============================\x1b[0m |
1030 | <a·id="__codelineno-0-19"·name="__codelineno-0-19"·href="#__codelineno-0-19"></a>\x1b[31mERROR\x1b[0m·test_something.py::\x1b[1mtest_something\x1b[0m·-·Failed:·your·snapshot·is·missing·one·value. | 1030 | <a·id="__codelineno-0-19"·name="__codelineno-0-19"·href="#__codelineno-0-19"></a>\x1b[31mERROR\x1b[0m·test_something.py::\x1b[1mtest_something\x1b[0m·-·Failed:·your·snapshot·is·missing·one·value. |
1031 | <a·id="__codelineno-0-20"·name="__codelineno-0-20"·href="#__codelineno-0-20"></a>\x1b[31m==========================·\x1b[32m1·passed\x1b[0m,·\x1b[31m\x1b[1m1·error\x1b[0m\x1b[31m·in·0. | 1031 | <a·id="__codelineno-0-20"·name="__codelineno-0-20"·href="#__codelineno-0-20"></a>\x1b[31m==========================·\x1b[32m1·passed\x1b[0m,·\x1b[31m\x1b[1m1·error\x1b[0m\x1b[31m·in·0.72s\x1b[0m\x1b[31m·==========================\x1b[0m |
1032 | </code></pre></div> | 1032 | </code></pre></div> |
1033 | <div·class="admonition·info"> | 1033 | <div·class="admonition·info"> |
1034 | <p·class="admonition-title">Info</p> | 1034 | <p·class="admonition-title">Info</p> |
1035 | <p>short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled·pytest·assert-rewriting. | 1035 | <p>short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled·pytest·assert-rewriting. |
1036 | This·option·will·be·replaced·with·<em>report</em>·when·this·restriction·is·lifted.</p> | 1036 | This·option·will·be·replaced·with·<em>report</em>·when·this·restriction·is·lifted.</p> |
1037 | </div> | 1037 | </div> |
1038 | <h2·id="-inline-snapshotreport">--inline-snapshot=report<a·class="headerlink"·href="#-inline-snapshotreport"·title="Permanent·link">¶</a></h2> | 1038 | <h2·id="-inline-snapshotreport">--inline-snapshot=report<a·class="headerlink"·href="#-inline-snapshotreport"·title="Permanent·link">¶</a></h2> |
1039 | <p>Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots</p> | 1039 | <p>Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots</p> |
1040 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a>\x1b[1;34m>·pytest·test_something.py·--inline-snapshot=report | 1040 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a>\x1b[1;34m>·pytest·test_something.py·--inline-snapshot=report |
1041 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a>\x1b[0m\x1b[1m=============================·test·session·starts·==============================\x1b[0m | 1041 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a>\x1b[0m\x1b[1m=============================·test·session·starts·==============================\x1b[0m |
1042 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 | 1042 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 |
1043 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp. | 1043 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp.kqzkycwHz5 |
1044 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:· | 1044 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1,·pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1 |
1045 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item | 1045 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item |
1046 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> | 1046 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> |
1047 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·\x1b[32m.\x1b[0m\x1b[31mE\x1b[0m\x1b[31m·····················································[100%]\x1b[0m | 1047 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·\x1b[32m.\x1b[0m\x1b[31mE\x1b[0m\x1b[31m·····················································[100%]\x1b[0m |
1048 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a> | 1048 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a> |
1049 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>====================================·ERRORS·==================================== | 1049 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>====================================·ERRORS·==================================== |
1050 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>\x1b[31m\x1b[1m_____________________·ERROR·at·teardown·of·test_something·______________________\x1b[0m | 1050 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>\x1b[31m\x1b[1m_____________________·ERROR·at·teardown·of·test_something·______________________\x1b[0m |
1051 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>\x1b[0myour·snapshot·\x1b[95mis\x1b[39;49;00m·missing·one·value.\x1b[90m\x1b[39;49;00m | 1051 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>\x1b[0myour·snapshot·\x1b[95mis\x1b[39;49;00m·missing·one·value.\x1b[90m\x1b[39;49;00m |
Offset 1077, 23 lines modified | Offset 1077, 23 lines modified | ||
1077 | <a·id="__codelineno-0-38"·name="__codelineno-0-38"·href="#__codelineno-0-38"></a>+------------------------------------------------------------------------------+ | 1077 | <a·id="__codelineno-0-38"·name="__codelineno-0-38"·href="#__codelineno-0-38"></a>+------------------------------------------------------------------------------+ |
1078 | <a·id="__codelineno-0-39"·name="__codelineno-0-39"·href="#__codelineno-0-39"></a>These·changes·are·not·applied. | 1078 | <a·id="__codelineno-0-39"·name="__codelineno-0-39"·href="#__codelineno-0-39"></a>These·changes·are·not·applied. |
1079 | <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· | 1079 | <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· |
1080 | <a·id="__codelineno-0-41"·name="__codelineno-0-41"·href="#__codelineno-0-41"></a>--inline-snapshot=review | 1080 | <a·id="__codelineno-0-41"·name="__codelineno-0-41"·href="#__codelineno-0-41"></a>--inline-snapshot=review |
1081 | <a·id="__codelineno-0-42"·name="__codelineno-0-42"·href="#__codelineno-0-42"></a> | 1081 | <a·id="__codelineno-0-42"·name="__codelineno-0-42"·href="#__codelineno-0-42"></a> |
1082 | <a·id="__codelineno-0-43"·name="__codelineno-0-43"·href="#__codelineno-0-43"></a>\x1b[36m\x1b[1m===========================·short·test·summary·info·============================\x1b[0m | 1082 | <a·id="__codelineno-0-43"·name="__codelineno-0-43"·href="#__codelineno-0-43"></a>\x1b[36m\x1b[1m===========================·short·test·summary·info·============================\x1b[0m |
1083 | <a·id="__codelineno-0-44"·name="__codelineno-0-44"·href="#__codelineno-0-44"></a>\x1b[31mERROR\x1b[0m·test_something.py::\x1b[1mtest_something\x1b[0m·-·Failed:·your·snapshot·is·missing·one·value. | 1083 | <a·id="__codelineno-0-44"·name="__codelineno-0-44"·href="#__codelineno-0-44"></a>\x1b[31mERROR\x1b[0m·test_something.py::\x1b[1mtest_something\x1b[0m·-·Failed:·your·snapshot·is·missing·one·value. |
1084 | <a·id="__codelineno-0-45"·name="__codelineno-0-45"·href="#__codelineno-0-45"></a>\x1b[31m==========================·\x1b[32m1·passed\x1b[0m,·\x1b[31m\x1b[1m1·error\x1b[0m\x1b[31m·in·0. | 1084 | <a·id="__codelineno-0-45"·name="__codelineno-0-45"·href="#__codelineno-0-45"></a>\x1b[31m==========================·\x1b[32m1·passed\x1b[0m,·\x1b[31m\x1b[1m1·error\x1b[0m\x1b[31m·in·0.45s\x1b[0m\x1b[31m·==========================\x1b[0m |
1085 | </code></pre></div> | 1085 | </code></pre></div> |
1086 | <h2·id="-inline-snapshotreview">--inline-snapshot=review<a·class="headerlink"·href="#-inline-snapshotreview"·title="Permanent·link">¶</a></h2> | 1086 | <h2·id="-inline-snapshotreview">--inline-snapshot=review<a·class="headerlink"·href="#-inline-snapshotreview"·title="Permanent·link">¶</a></h2> |
1087 | <p>Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes</p> | 1087 | <p>Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes</p> |
1088 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a>\x1b[1;34m>·pytest·test_something.py·--inline-snapshot=review | 1088 | <div·class="highlight"><pre><span></span><code><a·id="__codelineno-0-1"·name="__codelineno-0-1"·href="#__codelineno-0-1"></a>\x1b[1;34m>·pytest·test_something.py·--inline-snapshot=review |
1089 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a>\x1b[0m\x1b[1m=============================·test·session·starts·==============================\x1b[0m | 1089 | <a·id="__codelineno-0-2"·name="__codelineno-0-2"·href="#__codelineno-0-2"></a>\x1b[0m\x1b[1m=============================·test·session·starts·==============================\x1b[0m |
1090 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 | 1090 | <a·id="__codelineno-0-3"·name="__codelineno-0-3"·href="#__codelineno-0-3"></a>platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 |
1091 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp. | 1091 | <a·id="__codelineno-0-4"·name="__codelineno-0-4"·href="#__codelineno-0-4"></a>rootdir:·/tmp/tmp.VK12zROhLz |
1092 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:· | 1092 | <a·id="__codelineno-0-5"·name="__codelineno-0-5"·href="#__codelineno-0-5"></a>plugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1,·pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1 |
1093 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item | 1093 | <a·id="__codelineno-0-6"·name="__codelineno-0-6"·href="#__codelineno-0-6"></a>collected·1·item |
1094 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> | 1094 | <a·id="__codelineno-0-7"·name="__codelineno-0-7"·href="#__codelineno-0-7"></a> |
1095 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·\x1b[32m.\x1b[0m\x1b[32m······················································[100%]\x1b[0m | 1095 | <a·id="__codelineno-0-8"·name="__codelineno-0-8"·href="#__codelineno-0-8"></a>test_something.py·\x1b[32m.\x1b[0m\x1b[32m······················································[100%]\x1b[0m |
1096 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a>===============================·inline·snapshot·================================ | 1096 | <a·id="__codelineno-0-9"·name="__codelineno-0-9"·href="#__codelineno-0-9"></a>===============================·inline·snapshot·================================ |
1097 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>───────────────────────────────·Create·snapshots·─────────────────────────────── | 1097 | <a·id="__codelineno-0-10"·name="__codelineno-0-10"·href="#__codelineno-0-10"></a>───────────────────────────────·Create·snapshots·─────────────────────────────── |
1098 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>+-----------------------------·test_something.py·------------------------------+ | 1098 | <a·id="__codelineno-0-11"·name="__codelineno-0-11"·href="#__codelineno-0-11"></a>+-----------------------------·test_something.py·------------------------------+ |
1099 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>|·@@·-2,5·+2,5·@@······························································| | 1099 | <a·id="__codelineno-0-12"·name="__codelineno-0-12"·href="#__codelineno-0-12"></a>|·@@·-2,5·+2,5·@@······························································| |
Offset 1114, 15 lines modified | Offset 1114, 15 lines modified | ||
1114 | <a·id="__codelineno-0-27"·name="__codelineno-0-27"·href="#__codelineno-0-27"></a>|··def·test_something():·······················································| | 1114 | <a·id="__codelineno-0-27"·name="__codelineno-0-27"·href="#__codelineno-0-27"></a>|··def·test_something():·······················································| |
1115 | <a·id="__codelineno-0-28"·name="__codelineno-0-28"·href="#__codelineno-0-28"></a>|······assert·1·==·snapshot(1)·················································| | 1115 | <a·id="__codelineno-0-28"·name="__codelineno-0-28"·href="#__codelineno-0-28"></a>|······assert·1·==·snapshot(1)·················································| |
1116 | <a·id="__codelineno-0-29"·name="__codelineno-0-29"·href="#__codelineno-0-29"></a>|·-····assert·2·<=·snapshot(5)·················································| | 1116 | <a·id="__codelineno-0-29"·name="__codelineno-0-29"·href="#__codelineno-0-29"></a>|·-····assert·2·<=·snapshot(5)·················································| |
1117 | <a·id="__codelineno-0-30"·name="__codelineno-0-30"·href="#__codelineno-0-30"></a>|·+····assert·2·<=·snapshot(2)·················································| | 1117 | <a·id="__codelineno-0-30"·name="__codelineno-0-30"·href="#__codelineno-0-30"></a>|·+····assert·2·<=·snapshot(2)·················································| |
1118 | <a·id="__codelineno-0-31"·name="__codelineno-0-31"·href="#__codelineno-0-31"></a>+------------------------------------------------------------------------------+ | 1118 | <a·id="__codelineno-0-31"·name="__codelineno-0-31"·href="#__codelineno-0-31"></a>+------------------------------------------------------------------------------+ |
1119 | <a·id="__codelineno-0-32"·name="__codelineno-0-32"·href="#__codelineno-0-32"></a>do·you·want·to·trim·these·snapshots?·[y/n]·(n):· | 1119 | <a·id="__codelineno-0-32"·name="__codelineno-0-32"·href="#__codelineno-0-32"></a>do·you·want·to·trim·these·snapshots?·[y/n]·(n):· |
1120 | <a·id="__codelineno-0-33"·name="__codelineno-0-33"·href="#__codelineno-0-33"></a> | 1120 | <a·id="__codelineno-0-33"·name="__codelineno-0-33"·href="#__codelineno-0-33"></a> |
1121 | <a·id="__codelineno-0-34"·name="__codelineno-0-34"·href="#__codelineno-0-34"></a>\x1b[32m==============================·\x1b[32m\x1b[1m1·passed\x1b[0m\x1b[32m·in·0.2 | 1121 | <a·id="__codelineno-0-34"·name="__codelineno-0-34"·href="#__codelineno-0-34"></a>\x1b[32m==============================·\x1b[32m\x1b[1m1·passed\x1b[0m\x1b[32m·in·0.29s\x1b[0m\x1b[32m·===============================\x1b[0m |
1122 | </code></pre></div> | 1122 | </code></pre></div> |
1123 | <h2·id="-inline-snapshotdisable">--inline-snapshot=disable<a·class="headerlink"·href="#-inline-snapshotdisable"·title="Permanent·link">¶</a></h2> | 1123 | <h2·id="-inline-snapshotdisable">--inline-snapshot=disable<a·class="headerlink"·href="#-inline-snapshotdisable"·title="Permanent·link">¶</a></h2> |
1124 | <p>Disables·all·the·snapshot·logic.·<code>snapshot(x)</code>·will·just·return·<code>x</code>. | 1124 | <p>Disables·all·the·snapshot·logic.·<code>snapshot(x)</code>·will·just·return·<code>x</code>. |
1125 | 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> | 1125 | 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> |
1126 | <div·class="admonition·info"> | 1126 | <div·class="admonition·info"> |
1127 | <p·class="admonition-title">deprecation</p> | 1127 | <p·class="admonition-title">deprecation</p> |
1128 | <p>This·option·was·previously·called·<code>--inline-snapshot-disable</code></p> | 1128 | <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 | [1;34m>·pytest·test_something.py·--inline-snapshot=create,report | 69 | [1;34m>·pytest·test_something.py·--inline-snapshot=create,report |
70 | [0m\x1b[1m=============================·test·session·starts | 70 | [0m\x1b[1m=============================·test·session·starts |
71 | ==============================\x1b[0m | 71 | ==============================\x1b[0m |
72 | platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 | 72 | platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 |
73 | rootdir:·/tmp/tmp.UpwXd4fTD8 | ||
74 | plugins:·hypothesis-6.122.1,·subtests-0.13.1,·typeguard-4.4.1,·time-machine- | ||
75 | 73 | rootdir:·/tmp/tmp.I8WaL3lfzW | |
74 | plugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1, | ||
75 | pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1 | ||
76 | collected·1·item | 76 | collected·1·item |
77 | test_something.py·\x1b[32m.\x1b[0m\x1b[32m | 77 | test_something.py·\x1b[32m.\x1b[0m\x1b[32m |
78 | [100%]\x1b[0m | 78 | [100%]\x1b[0m |
79 | ===============================·inline·snapshot | 79 | ===============================·inline·snapshot |
80 | ================================ | 80 | ================================ |
81 | ───────────────────────────────·Create·snapshots | 81 | ───────────────────────────────·Create·snapshots |
Offset 124, 25 lines modified | Offset 124, 25 lines modified | ||
124 | +------------------------------------------------------------------------------ | 124 | +------------------------------------------------------------------------------ |
125 | + | 125 | + |
126 | These·changes·are·not·applied. | 126 | These·changes·are·not·applied. |
127 | Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with | 127 | Use·--inline-snapshot=trim·to·apply·them,·or·use·the·interactive·mode·with |
128 | --inline-snapshot=review | 128 | --inline-snapshot=review |
129 | [32m==============================·\x1b[32m\x1b[1m1·passed\x1b[0m\x1b[32m·in·0. | 129 | [32m==============================·\x1b[32m\x1b[1m1·passed\x1b[0m\x1b[32m·in·0.98s\x1b[0m\x1b[32m |
130 | ===============================\x1b[0m | 130 | ===============================\x1b[0m |
131 | *\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 | *\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* |
132 | give·a·short·report·over·which·changes·can·be·made·to·the·snapshots | 132 | give·a·short·report·over·which·changes·can·be·made·to·the·snapshots |
133 | [1;34m>·pytest·test_something.py·--inline-snapshot=short-report | 133 | [1;34m>·pytest·test_something.py·--inline-snapshot=short-report |
134 | [0m\x1b[1m=============================·test·session·starts | 134 | [0m\x1b[1m=============================·test·session·starts |
135 | ==============================\x1b[0m | 135 | ==============================\x1b[0m |
136 | platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 | 136 | platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 |
137 | rootdir:·/tmp/tmp.mKAvW4hRz8 | ||
138 | plugins:·hypothesis-6.122.1,·subtests-0.13.1,·typeguard-4.4.1,·time-machine- | ||
139 | 137 | rootdir:·/tmp/tmp.w45CMeENlp | |
138 | plugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1, | ||
139 | pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1 | ||
140 | collected·1·item | 140 | collected·1·item |
141 | test_something.py·\x1b[32m.\x1b[0m\x1b[31mE\x1b[0m\x1b[31m | 141 | test_something.py·\x1b[32m.\x1b[0m\x1b[31mE\x1b[0m\x1b[31m |
142 | [100%]\x1b[0m | 142 | [100%]\x1b[0m |
143 | ====================================·ERRORS | 143 | ====================================·ERRORS |
144 | ==================================== | 144 | ==================================== |
Offset 156, 28 lines modified | Offset 156, 28 lines modified | ||
156 | You·can·also·use·--inline-snapshot=review·to·approve·the·changes·interactively | 156 | You·can·also·use·--inline-snapshot=review·to·approve·the·changes·interactively |
157 | [36m\x1b[1m===========================·short·test·summary·info | 157 | [36m\x1b[1m===========================·short·test·summary·info |
158 | ============================\x1b[0m | 158 | ============================\x1b[0m |
159 | [31mERROR\x1b[0m·test_something.py::\x1b[1mtest_something\x1b[0m·-·Failed:·your·snapshot | 159 | [31mERROR\x1b[0m·test_something.py::\x1b[1mtest_something\x1b[0m·-·Failed:·your·snapshot |
160 | is·missing·one·value. | 160 | is·missing·one·value. |
161 | [31m==========================·\x1b[32m1·passed\x1b[0m,·\x1b[31m\x1b[1m1·error\x1b[0m\x1b[31m·in | 161 | [31m==========================·\x1b[32m1·passed\x1b[0m,·\x1b[31m\x1b[1m1·error\x1b[0m\x1b[31m·in |
162 | 0. | 162 | 0.72s\x1b[0m\x1b[31m·==========================\x1b[0m |
163 | Info | 163 | Info |
164 | short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled | 164 | short-report·exists·mainly·to·show·that·snapshots·have·changed·with·enabled |
165 | pytest·assert-rewriting.·This·option·will·be·replaced·with·r\x8re\x8ep\x8po\x8or\x8rt\x8t·when·this | 165 | pytest·assert-rewriting.·This·option·will·be·replaced·with·r\x8re\x8ep\x8po\x8or\x8rt\x8t·when·this |
166 | restriction·is·lifted. | 166 | restriction·is·lifted. |
167 | *\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* | 167 | *\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* |
168 | Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots | 168 | Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots |
169 | [1;34m>·pytest·test_something.py·--inline-snapshot=report | 169 | [1;34m>·pytest·test_something.py·--inline-snapshot=report |
170 | [0m\x1b[1m=============================·test·session·starts | 170 | [0m\x1b[1m=============================·test·session·starts |
171 | ==============================\x1b[0m | 171 | ==============================\x1b[0m |
172 | platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 | 172 | platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 |
173 | rootdir:·/tmp/tmp.jrguQc6B1u | ||
174 | plugins:·hypothesis-6.122.1,·subtests-0.13.1,·typeguard-4.4.1,·time-machine- | ||
175 | 173 | rootdir:·/tmp/tmp.kqzkycwHz5 | |
174 | plugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1, | ||
175 | pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1 | ||
176 | collected·1·item | 176 | collected·1·item |
177 | test_something.py·\x1b[32m.\x1b[0m\x1b[31mE\x1b[0m\x1b[31m | 177 | test_something.py·\x1b[32m.\x1b[0m\x1b[31mE\x1b[0m\x1b[31m |
178 | [100%]\x1b[0m | 178 | [100%]\x1b[0m |
179 | ====================================·ERRORS | 179 | ====================================·ERRORS |
180 | ==================================== | 180 | ==================================== |
Offset 237, 24 lines modified | Offset 237, 24 lines modified | ||
237 | --inline-snapshot=review | 237 | --inline-snapshot=review |
238 | [36m\x1b[1m===========================·short·test·summary·info | 238 | [36m\x1b[1m===========================·short·test·summary·info |
239 | ============================\x1b[0m | 239 | ============================\x1b[0m |
240 | [31mERROR\x1b[0m·test_something.py::\x1b[1mtest_something\x1b[0m·-·Failed:·your·snapshot | 240 | [31mERROR\x1b[0m·test_something.py::\x1b[1mtest_something\x1b[0m·-·Failed:·your·snapshot |
241 | is·missing·one·value. | 241 | is·missing·one·value. |
242 | [31m==========================·\x1b[32m1·passed\x1b[0m,·\x1b[31m\x1b[1m1·error\x1b[0m\x1b[31m·in | 242 | [31m==========================·\x1b[32m1·passed\x1b[0m,·\x1b[31m\x1b[1m1·error\x1b[0m\x1b[31m·in |
243 | 0. | 243 | 0.45s\x1b[0m\x1b[31m·==========================\x1b[0m |
244 | *\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* | 244 | *\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* |
245 | Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes | 245 | Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes |
246 | [1;34m>·pytest·test_something.py·--inline-snapshot=review | 246 | [1;34m>·pytest·test_something.py·--inline-snapshot=review |
247 | [0m\x1b[1m=============================·test·session·starts | 247 | [0m\x1b[1m=============================·test·session·starts |
248 | ==============================\x1b[0m | 248 | ==============================\x1b[0m |
249 | platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 | 249 | platform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0 |
250 | rootdir:·/tmp/tmp.hjtHEtL0Id | ||
251 | plugins:·hypothesis-6.122.1,·subtests-0.13.1,·typeguard-4.4.1,·time-machine- | ||
252 | 250 | rootdir:·/tmp/tmp.VK12zROhLz | |
251 | plugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1, | ||
252 | pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1 | ||
253 | collected·1·item | 253 | collected·1·item |
254 | test_something.py·\x1b[32m.\x1b[0m\x1b[32m | 254 | test_something.py·\x1b[32m.\x1b[0m\x1b[32m |
255 | [100%]\x1b[0m | 255 | [100%]\x1b[0m |
256 | ===============================·inline·snapshot | 256 | ===============================·inline·snapshot |
257 | ================================ | 257 | ================================ |
258 | ───────────────────────────────·Create·snapshots | 258 | ───────────────────────────────·Create·snapshots |
Offset 298, 15 lines modified | Offset 298, 15 lines modified | ||
298 | | | 298 | | |
299 | |·+····assert·2·<=·snapshot(2) | 299 | |·+····assert·2·<=·snapshot(2) |
300 | | | 300 | | |
301 | +------------------------------------------------------------------------------ | 301 | +------------------------------------------------------------------------------ |
302 | + | 302 | + |
303 | do·you·want·to·trim·these·snapshots?·[y/n]·(n): | 303 | do·you·want·to·trim·these·snapshots?·[y/n]·(n): |
304 | [32m==============================·\x1b[32m\x1b[1m1·passed\x1b[0m\x1b[32m·in·0.2 | 304 | [32m==============================·\x1b[32m\x1b[1m1·passed\x1b[0m\x1b[32m·in·0.29s\x1b[0m\x1b[32m |
305 | ===============================\x1b[0m | 305 | ===============================\x1b[0m |
306 | *\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* | 306 | *\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* |
307 | Disables·all·the·snapshot·logic.·snapshot(x)·will·just·return·x.·This·can·be | 307 | Disables·all·the·snapshot·logic.·snapshot(x)·will·just·return·x.·This·can·be |
308 | used·if·you·think·exclude·that·snapshot·logic·causes·a·problem·in·your·tests, | 308 | used·if·you·think·exclude·that·snapshot·logic·causes·a·problem·in·your·tests, |
309 | or·if·you·want·to·speedup·your·CI. | 309 | or·if·you·want·to·speedup·your·CI. |
310 | deprecation | 310 | deprecation |
311 | This·option·was·previously·called·--inline-snapshot-disable | 311 | This·option·was·previously·called·--inline-snapshot-disable |
Offset 537, 20 lines modified | Offset 537, 20 lines modified | ||
537 | ········{ | 537 | ········{ |
538 | ············"location":·"extra.html#inline_snapshot.extra", | 538 | ············"location":·"extra.html#inline_snapshot.extra", |
539 | ············"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>", | 539 | ············"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>", |
540 | ············"title":·"<code>inline_snapshot.extra</code>" | 540 | ············"title":·"<code>inline_snapshot.extra</code>" |
541 | ········}, | 541 | ········}, |
542 | ········{ | 542 | ········{ |
543 | ············"location":·"extra.html#inline_snapshot.extra.prints", | 543 | ············"location":·"extra.html#inline_snapshot.extra.prints", |
544 | ············"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 | 544 | ············"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>", |
545 | ············"title":·"<code>prints(*,·stdout='',·stderr='')</code>" | 545 | ············"title":·"<code>prints(*,·stdout='',·stderr='')</code>" |
546 | ········}, | 546 | ········}, |
547 | ········{ | 547 | ········{ |
548 | ············"location":·"extra.html#inline_snapshot.extra.raises", | 548 | ············"location":·"extra.html#inline_snapshot.extra.raises", |
549 | ············"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 | 549 | ············"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>", |
550 | ············"title":·"<code>raises(exception)</code>" | 550 | ············"title":·"<code>raises(exception)</code>" |
551 | ········}, | 551 | ········}, |
552 | ········{ | 552 | ········{ |
553 | ············"location":·"getitem_snapshot.html", | 553 | ············"location":·"getitem_snapshot.html", |
554 | ············"text":·"", | 554 | ············"text":·"", |
555 | ············"title":·"snapshot()[key]" | 555 | ············"title":·"snapshot()[key]" |
556 | ········}, | 556 | ········}, |
Offset 612, 65 lines modified | Offset 612, 65 lines modified | ||
612 | ········{ | 612 | ········{ |
613 | ············"location":·"outsource.html#api", | 613 | ············"location":·"outsource.html#api", |
614 | ············"text":·"", | 614 | ············"text":·"", |
615 | ············"title":·"API" | 615 | ············"title":·"API" |
616 | ········}, | 616 | ········}, |
617 | ········{ | 617 | ········{ |
618 | ············"location":·"outsource.html#inline_snapshot.outsource", | 618 | ············"location":·"outsource.html#inline_snapshot.outsource", |
619 | ············"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 | 619 | ············"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>", |
620 | ············"title":·"<code>inline_snapshot.outsource(data,·*,·suffix=None)</code>" | 620 | ············"title":·"<code>inline_snapshot.outsource(data,·*,·suffix=None)</code>" |
621 | ········}, | 621 | ········}, |
622 | ········{ | 622 | ········{ |
623 | ············"location":·"outsource.html#inline_snapshot.external", | 623 | ············"location":·"outsource.html#inline_snapshot.external", |
624 | ············"text":·"Source·code·in·<code>.pybuild/cpython3_3.1 | 624 | ············"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·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········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>", |
625 | ············"title":·"<code>inline_snapshot.external</code>" | 625 | ············"title":·"<code>inline_snapshot.external</code>" |
626 | ········}, | 626 | ········}, |
627 | ········{ | 627 | ········{ |
628 | ············"location":·"outsource.html#inline_snapshot.external.__eq__", | 628 | ············"location":·"outsource.html#inline_snapshot.external.__eq__", |
629 | ············"text":·"<p>Two·external·objects·are·equal·if·they·have·the·same·hash·and·suffix.</p>·Source·code·in·<code>.pybuild/cpython3_3.1 | 629 | ············"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>", |
630 | ············"title":·"<code>__eq__(other)</code>" | 630 | ············"title":·"<code>__eq__(other)</code>" |
631 | ········}, | 631 | ········}, |
632 | ········{ | 632 | ········{ |
633 | ············"location":·"outsource.html#inline_snapshot.external.__init__", | 633 | ············"location":·"outsource.html#inline_snapshot.external.__init__", |
634 | ············"text":·"<p>External·objects·are·used·as·a·representation·for·outsourced·data.·You·should·not·create·them·directly.</p>·<p>The·external·data·is·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.·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 | 634 | ············"text":·"<p>External·objects·are·used·as·a·representation·for·outsourced·data.·You·should·not·create·them·directly.</p>·<p>The·external·data·is·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.·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·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····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>", |
635 | ············"title":·"<code>__init__(name)</code>" | 635 | ············"title":·"<code>__init__(name)</code>" |
636 | ········}, | 636 | ········}, |
637 | ········{ | 637 | ········{ |
638 | ············"location":·"outsource.html#inline_snapshot.external.__repr__", | 638 | ············"location":·"outsource.html#inline_snapshot.external.__repr__", |
639 | ············"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 | 639 | ············"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>", |
640 | ············"title":·"<code>__repr__()</code>" | 640 | ············"title":·"<code>__repr__()</code>" |
641 | ········}, | 641 | ········}, |
642 | ········{ | 642 | ········{ |
643 | ············"location":·"outsource.html#pytest-options", | 643 | ············"location":·"outsource.html#pytest-options", |
644 | ············"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>", | 644 | ············"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>", |
645 | ············"title":·"pytest·options" | 645 | ············"title":·"pytest·options" |
646 | ········}, | 646 | ········}, |
647 | ········{ | 647 | ········{ |
648 | ············"location":·"pytest.html", | 648 | ············"location":·"pytest.html", |
649 | ············"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>", | 649 | ············"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>", |
650 | ············"title":·"pytest·integration" | 650 | ············"title":·"pytest·integration" |
651 | ········}, | 651 | ········}, |
652 | ········{ | 652 | ········{ |
653 | ············"location":·"pytest.html#-inline-snapshotcreatefixtrimupdate", | 653 | ············"location":·"pytest.html#-inline-snapshotcreatefixtrimupdate", |
654 | ············"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>\u001b[1;34m>·pytest·test_something.py·--inline-snapshot=create,report\n\u001b[0m\u001b[1m=============================·test·session·starts·==============================\u001b[0m\nplatform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0\nrootdir:·/tmp/tmp. | 654 | ············"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>\u001b[1;34m>·pytest·test_something.py·--inline-snapshot=create,report\n\u001b[0m\u001b[1m=============================·test·session·starts·==============================\u001b[0m\nplatform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0\nrootdir:·/tmp/tmp.I8WaL3lfzW\nplugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1,·pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1\ncollected·1·item\n\ntest_something.py·\u001b[32m.\u001b[0m\u001b[32m··············································[·...·truncated·by·diffoscope;·len:·2778,·SHA:·f24765c3a81058da0bcc18e2c52491eb151c95fd6bd1f324b737eebdf07c8e30·...·]s\u001b[0m\u001b[32m·===============================\u001b[0m\n</code></pre>", |
655 | ············"title":·"--inline-snapshot=create,fix,trim,update" | 655 | ············"title":·"--inline-snapshot=create,fix,trim,update" |
656 | ········}, | 656 | ········}, |
657 | ········{ | 657 | ········{ |
658 | ············"location":·"pytest.html#-inline-snapshotshort-report", | 658 | ············"location":·"pytest.html#-inline-snapshotshort-report", |
659 | ············"text":·"<p>give·a·short·report·over·which·changes·can·be·made·to·the·snapshots</p>·<pre><code>\u001b[1;34m>·pytest·test_something.py·--inline-snapshot=short-report\n\u001b[0m\u001b[1m=============================·test·session·starts·==============================\u001b[0m\nplatform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0\nrootdir:·/tmp/tmp. | 659 | ············"text":·"<p>give·a·short·report·over·which·changes·can·be·made·to·the·snapshots</p>·<pre><code>\u001b[1;34m>·pytest·test_something.py·--inline-snapshot=short-report\n\u001b[0m\u001b[1m=============================·test·session·starts·==============================\u001b[0m\nplatform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0\nrootdir:·/tmp/tmp.w45CMeENlp\nplugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1,·pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1\ncollected·1·item\n\ntest_something.py·\u001b[32m.\u001b[0m\u001b[31mE\u001b[0m\u001b[31m··························[·...·truncated·by·diffoscope;·len:·980,·SHA:·680b4c9f59d56347914215da192338012f323cae06da1705728b385936a3b8db·...·]s\u001b[0m\u001b[31m·==========================\u001b[0m\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>", |
660 | ············"title":·"--inline-snapshot=short-report" | 660 | ············"title":·"--inline-snapshot=short-report" |
661 | ········}, | 661 | ········}, |
662 | ········{ | 662 | ········{ |
663 | ············"location":·"pytest.html#-inline-snapshotreport", | 663 | ············"location":·"pytest.html#-inline-snapshotreport", |
664 | ············"text":·"<p>Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots</p>·<pre><code>\u001b[1;34m>·pytest·test_something.py·--inline-snapshot=report\n\u001b[0m\u001b[1m=============================·test·session·starts·==============================\u001b[0m\nplatform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0\nrootdir:·/tmp/tmp. | 664 | ············"text":·"<p>Shows·a·diff·report·over·which·changes·can·be·made·to·the·snapshots</p>·<pre><code>\u001b[1;34m>·pytest·test_something.py·--inline-snapshot=report\n\u001b[0m\u001b[1m=============================·test·session·starts·==============================\u001b[0m\nplatform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0\nrootdir:·/tmp/tmp.kqzkycwHz5\nplugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1,·pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1\ncollected·1·item\n\ntest_something.py·\u001b[32m.\u001b[0m\u001b[31mE\u001b[0m\u001b[31m··························[·...·truncated·by·diffoscope;·len:·3408,·SHA:·c84733d960ff8113d7b61bde339441a9d9279fb0327f9a1b5983cb0b78a9b14a·...·]s\u001b[0m\u001b[31m·==========================\u001b[0m\n</code></pre>", |
665 | ············"title":·"--inline-snapshot=report" | 665 | ············"title":·"--inline-snapshot=report" |
666 | ········}, | 666 | ········}, |
667 | ········{ | 667 | ········{ |
668 | ············"location":·"pytest.html#-inline-snapshotreview", | 668 | ············"location":·"pytest.html#-inline-snapshotreview", |
669 | ············"text":·"<p>Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes</p>·<pre><code>\u001b[1;34m>·pytest·test_something.py·--inline-snapshot=review\n\u001b[0m\u001b[1m=============================·test·session·starts·==============================\u001b[0m\nplatform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0\nrootdir:·/tmp/tmp. | 669 | ············"text":·"<p>Shows·a·diff·report·for·each·category·and·ask·if·you·want·to·apply·the·changes</p>·<pre><code>\u001b[1;34m>·pytest·test_something.py·--inline-snapshot=review\n\u001b[0m\u001b[1m=============================·test·session·starts·==============================\u001b[0m\nplatform·linux·--·Python·3.12.7,·pytest-8.3.3,·pluggy-1.5.0\nrootdir:·/tmp/tmp.VK12zROhLz\nplugins:·inline-snapshot-0.14.0,·time-machine-2.14.1,·hypothesis-6.122.1,·pytest_freezer-0.4.8,·typeguard-4.4.1,·subtests-0.13.1\ncollected·1·item\n\ntest_something.py·\u001b[32m.\u001b[0m\u001b[32m··············································[·...·truncated·by·diffoscope;·len:·2667,·SHA:·5ac877edeaeb779ab8bdd100a28e08d803a0163a1b5b363b11a809f83c6e2aef·...·]s\u001b[0m\u001b[32m·===============================\u001b[0m\n</code></pre>", |
670 | ············"title":·"--inline-snapshot=review" | 670 | ············"title":·"--inline-snapshot=review" |
671 | ········}, | 671 | ········}, |
672 | ········{ | 672 | ········{ |
673 | ············"location":·"pytest.html#-inline-snapshotdisable", | 673 | ············"location":·"pytest.html#-inline-snapshotdisable", |
674 | ············"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>", | 674 | ············"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>", |
675 | ············"title":·"--inline-snapshot=disable" | 675 | ············"title":·"--inline-snapshot=disable" |
676 | ········}, | 676 | ········}, |
Offset 722, 12 lines modified | Offset 722, 12 lines modified | ||
722 | ········{ | 722 | ········{ |
723 | ············"location":·"types.html#inline_snapshot.Category", | 723 | ············"location":·"types.html#inline_snapshot.Category", |
724 | ············"text":·"<p>See·categories</p>", | 724 | ············"text":·"<p>See·categories</p>", |
725 | ············"title":·"<code>Category·=·Literal['update',·'fix',·'create',·'trim']</code>··<code>module-attribute</code>" | 725 | ············"title":·"<code>Category·=·Literal['update',·'fix',·'create',·'trim']</code>··<code>module-attribute</code>" |
726 | ········}, | 726 | ········}, |
727 | ········{ | 727 | ········{ |
728 | ············"location":·"types.html#inline_snapshot.Snapshot", | 728 | ············"location":·"types.html#inline_snapshot.Snapshot", |
729 | ············"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 | 729 | ············"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>", |
730 | ············"title":·"<code>Snapshot</code>" | 730 | ············"title":·"<code>Snapshot</code>" |
731 | ········} | 731 | ········} |
732 | ····] | 732 | ····] |
733 | } | 733 | } |
Offset 1001, 15 lines modified | Offset 1001, 15 lines modified | ||
1001 | ··············<details·class="quote"> | 1001 | ··············<details·class="quote"> |
1002 | ················<summary>Source·code·in·<code>.pybuild/cpython3_3.1 | 1002 | ················<summary>Source·code·in·<code>.pybuild/cpython3_3.12_inline-snapshot/build/inline_snapshot/_types.py</code></summary> |
1003 | ················<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> | 1003 | ················<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> |
1004 | <span·class="normal"><a·href="#__codelineno-0-22">22</a></span> | 1004 | <span·class="normal"><a·href="#__codelineno-0-22">22</a></span> |
1005 | <span·class="normal"><a·href="#__codelineno-0-23">23</a></span> | 1005 | <span·class="normal"><a·href="#__codelineno-0-23">23</a></span> |
1006 | <span·class="normal"><a·href="#__codelineno-0-24">24</a></span> | 1006 | <span·class="normal"><a·href="#__codelineno-0-24">24</a></span> |
1007 | <span·class="normal"><a·href="#__codelineno-0-25">25</a></span> | 1007 | <span·class="normal"><a·href="#__codelineno-0-25">25</a></span> |
1008 | <span·class="normal"><a·href="#__codelineno-0-26">26</a></span> | 1008 | <span·class="normal"><a·href="#__codelineno-0-26">26</a></span> |
1009 | <span·class="normal"><a·href="#__codelineno-0-27">27</a></span> | 1009 | <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. |