mirror of
https://github.com/d3vyce/fastapi-toolsets.git
synced 2026-08-04 23:54:09 +00:00
Deployed 06d49d5 to v5.0 with Zensical 0.0.43 and mike 2.2.0+zensical-0.1.0
This commit is contained in:
+466
-158
@@ -1286,6 +1286,17 @@
|
||||
<nav class="md-nav" aria-label="FixtureRegistry">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.field" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
field
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.get" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
@@ -1317,6 +1328,28 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.get_dependencies" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
get_dependencies
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.get_load_variants" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
get_load_variants
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
@@ -1339,6 +1372,17 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.obj" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
obj
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
@@ -1399,17 +1443,6 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.utils.get_obj_by_attr" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
get_obj_by_attr
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
@@ -2024,6 +2057,17 @@
|
||||
<nav class="md-nav" aria-label="FixtureRegistry">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.field" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
field
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.get" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
@@ -2055,6 +2099,28 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.get_dependencies" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
get_dependencies
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.get_load_variants" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
get_load_variants
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
@@ -2077,6 +2143,17 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.obj" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
obj
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
@@ -2137,17 +2214,6 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#fastapi_toolsets.fixtures.utils.get_obj_by_attr" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
<span class="md-typeset">
|
||||
get_obj_by_attr
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
@@ -2265,8 +2331,7 @@
|
||||
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">FixtureRegistry</span><span class="p">,</span>
|
||||
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="n">load_fixtures</span><span class="p">,</span>
|
||||
</span><span id="__span-0-7"><a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a> <span class="n">load_fixtures_by_context</span><span class="p">,</span>
|
||||
</span><span id="__span-0-8"><a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="n">get_obj_by_attr</span><span class="p">,</span>
|
||||
</span><span id="__span-0-9"><a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="p">)</span>
|
||||
</span><span id="__span-0-8"><a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="p">)</span>
|
||||
</span></code></pre></div>
|
||||
|
||||
|
||||
@@ -2630,8 +2695,6 @@ def users():
|
||||
@fixtures.register(contexts=[Context.TESTING])
|
||||
def users():
|
||||
return [User(id=2, username="tester")]
|
||||
# load_fixtures_by_context(..., Context.BASE, Context.TESTING)
|
||||
# → loads both User(admin) and User(tester) under the "users" name
|
||||
```
|
||||
</code></pre></div>
|
||||
|
||||
@@ -2656,6 +2719,159 @@ def users():
|
||||
|
||||
|
||||
|
||||
<div class="doc doc-object doc-function">
|
||||
|
||||
|
||||
<h3 id="fastapi_toolsets.fixtures.registry.FixtureRegistry.field" class="doc doc-heading">
|
||||
<code class="highlight language-python"><span class="n">field</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">attr_name</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="s1">'id'</span><span class="p">)</span></code>
|
||||
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.field" class="headerlink" title="Permanent link">¶</a></h3>
|
||||
|
||||
|
||||
<div class="doc doc-contents ">
|
||||
|
||||
<p>Get a single field value from a fixture object matched by an attribute.</p>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Parameters:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>name</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Fixture name to look up.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>attr_name</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Name of the attribute to match against.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>value</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" title="typing.Any" href="https://docs.python.org/3/library/typing.html#typing.Any">Any</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Value to match.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>field</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Attribute name to return from the matched object (default: <code>"id"</code>).</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<code>'id'</code>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Returns:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" title="typing.Any" href="https://docs.python.org/3/library/typing.html#typing.Any">Any</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>The value of <code>field</code> on the first matching model instance.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Raises:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#KeyError">KeyError</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If no fixture named <em>name</em> is registered.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#StopIteration">StopIteration</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If no matching object is found.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="doc doc-object doc-function">
|
||||
|
||||
|
||||
@@ -2747,6 +2963,88 @@ def users():
|
||||
<div class="doc doc-object doc-function">
|
||||
|
||||
|
||||
<h3 id="fastapi_toolsets.fixtures.registry.FixtureRegistry.get_dependencies" class="doc doc-heading">
|
||||
<code class="highlight language-python"><span class="n">get_dependencies</span><span class="p">(</span><span class="n">name</span><span class="p">)</span></code>
|
||||
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.get_dependencies" class="headerlink" title="Permanent link">¶</a></h3>
|
||||
|
||||
|
||||
<div class="doc doc-contents ">
|
||||
|
||||
<p>Get the union of <code>depends_on</code> across all variants of <em>name</em>.</p>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Raises:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#KeyError">KeyError</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If no fixture named <em>name</em> is registered.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="doc doc-object doc-function">
|
||||
|
||||
|
||||
<h3 id="fastapi_toolsets.fixtures.registry.FixtureRegistry.get_load_variants" class="doc doc-heading">
|
||||
<code class="highlight language-python"><span class="n">get_load_variants</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="o">*</span><span class="n">contexts</span><span class="p">)</span></code>
|
||||
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.get_load_variants" class="headerlink" title="Permanent link">¶</a></h3>
|
||||
|
||||
|
||||
<div class="doc doc-contents ">
|
||||
|
||||
<p>Return variants for <em>name</em> filtered by <em>contexts</em>.</p>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Raises:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#KeyError">KeyError</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If no fixture with <em>name</em> is registered.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="doc doc-object doc-function">
|
||||
|
||||
|
||||
<h3 id="fastapi_toolsets.fixtures.registry.FixtureRegistry.get_variants" class="doc doc-heading">
|
||||
<code class="highlight language-python"><span class="n">get_variants</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="o">*</span><span class="n">contexts</span><span class="p">)</span></code>
|
||||
|
||||
@@ -2795,8 +3093,9 @@ def users():
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If given, only return variants whose context set
|
||||
intersects with these values. Both :class:<code>Context</code> enum
|
||||
values and plain strings are accepted.</p>
|
||||
intersects with these values (:class:<code>Context.BASE</code> variants
|
||||
are always included). Both :class:<code>Context</code> enum values and
|
||||
plain strings are accepted.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@@ -2967,6 +3266,143 @@ do not overlap. Conflicting contexts raise :class:<code>ValueError</code>.</p>
|
||||
<div class="doc doc-object doc-function">
|
||||
|
||||
|
||||
<h3 id="fastapi_toolsets.fixtures.registry.FixtureRegistry.obj" class="doc doc-heading">
|
||||
<code class="highlight language-python"><span class="n">obj</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">attr_name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span></code>
|
||||
|
||||
<a href="#fastapi_toolsets.fixtures.registry.FixtureRegistry.obj" class="headerlink" title="Permanent link">¶</a></h3>
|
||||
|
||||
|
||||
<div class="doc doc-contents ">
|
||||
|
||||
<p>Get a model instance from a registered fixture by attribute value.</p>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Parameters:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>name</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Fixture name to look up.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>attr_name</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Name of the attribute to match against.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>value</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" title="typing.Any" href="https://docs.python.org/3/library/typing.html#typing.Any">Any</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Value to match.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Returns:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><span title="sqlalchemy.orm.DeclarativeBase">DeclarativeBase</span></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>The first model instance where the attribute matches the given value.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Raises:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#KeyError">KeyError</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If no fixture named <em>name</em> is registered.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#StopIteration">StopIteration</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If no matching object is found.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="doc doc-object doc-function">
|
||||
|
||||
|
||||
<h3 id="fastapi_toolsets.fixtures.registry.FixtureRegistry.register" class="doc doc-heading">
|
||||
<code class="highlight language-python"><span class="n">register</span><span class="p">(</span><span class="n">func</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">depends_on</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">contexts</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span></code>
|
||||
|
||||
@@ -3461,8 +3897,8 @@ variants' <code>depends_on</code> lists is used.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Contexts to load (e.g., <code>Context.BASE</code>, <code>Context.TESTING</code>,
|
||||
or plain strings for custom contexts)</p>
|
||||
<p>Contexts to load (e.g., <code>Context.TESTING</code>, or plain
|
||||
strings for custom contexts)</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@@ -3521,134 +3957,6 @@ or plain strings for custom contexts)</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="doc doc-object doc-function">
|
||||
|
||||
|
||||
<h2 id="fastapi_toolsets.fixtures.utils.get_obj_by_attr" class="doc doc-heading">
|
||||
<code class="highlight language-python"><span class="n">fastapi_toolsets</span><span class="o">.</span><span class="n">fixtures</span><span class="o">.</span><span class="n">utils</span><span class="o">.</span><span class="n">get_obj_by_attr</span><span class="p">(</span><span class="n">fixtures</span><span class="p">,</span> <span class="n">attr_name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span></code>
|
||||
|
||||
<a href="#fastapi_toolsets.fixtures.utils.get_obj_by_attr" class="headerlink" title="Permanent link">¶</a></h2>
|
||||
|
||||
|
||||
<div class="doc doc-contents first">
|
||||
|
||||
<p>Get a SQLAlchemy model instance by matching an attribute value.</p>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Parameters:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>fixtures</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" title="collections.abc.Callable" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable">Callable</a>[[], <a class="autorefs autorefs-external" title="collections.abc.Sequence" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence">Sequence</a>[<span title="fastapi_toolsets.types.ModelType">ModelType</span>]]</code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>A fixture function registered via <code>@registry.register</code>
|
||||
that returns a sequence of SQLAlchemy model instances.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>attr_name</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/stdtypes.html#str">str</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Name of the attribute to match against.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code>value</code>
|
||||
</td>
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" title="typing.Any" href="https://docs.python.org/3/library/typing.html#typing.Any">Any</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>Value to match.</p>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<em>required</em>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Returns:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><span title="fastapi_toolsets.types.ModelType">ModelType</span></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>The first model instance where the attribute matches the given value.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><span class="doc-section-title">Raises:</span></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="doc-section-item">
|
||||
<td>
|
||||
<code><a class="autorefs autorefs-external" href="https://docs.python.org/3/library/exceptions.html#StopIteration">StopIteration</a></code>
|
||||
</td>
|
||||
<td>
|
||||
<div class="doc-md-description">
|
||||
<p>If no matching object is found in the fixture group.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user