TODO: write readme
| # @ https://cheat.readthedocs.io/en/latest/python/mock.html | |
| obj.call_count # number of times it was called | |
| obj.called == obj.call_count > 0 | |
| obj.call_args_list # a list of (args,kwargs), one for each call | |
| obj.call_args # obj.call_args_list[-1] (args,kwargs from last call) | |
| obj.return_value # set to what it should return | |
| obj.side_effect # set to an exception class or instance that should be raised when its called | |
| obj.assert_called() # doesn't work with autospec=True? just assert obj.called | |
| obj.assert_called_with(*args, **kwargs) # last call was with (*args, **kwargs) |
| <form action="" method="POST" role="form" class="form"> | |
| {{ form.hidden_tag() }} | |
| <!--Other fields--> | |
| {{ wtf.form_field(form.tags, placeholder='audio, hardware, chip') }} | |
| <button class="btn btn-success" type="submit">submit</button> | |
| </form> |
| # Courtesy of: https://stackoverflow.com/a/11974399 | |
| {%- for item in items %} | |
| [ | |
| "{{item}}"{{ "," if not loop.last }} | |
| ] | |
| {%- endfor %} |
| name: CI | |
| on: [push] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: |
| <!-- Create badges / shields like on shields.io | |
| -- but with bootstrap. | |
| -- | |
| -- Fully adjustable, use this for whatever you want ^^ | |
| -- | |
| -- Finn M Glas, 2020-07-06 | |
| --> | |
| <!-- Regular badges (value-only) --> |
| var socket; | |
| var fcastUrl; | |
| fetch('https://fastcast.semfs.engsvc.go.com/public/websockethost') | |
| .then( | |
| function(response) { | |
| if (response.status !== 200) { | |
| console.log('Looks like there was a problem. Status Code: ' + response.status); | |
| return; | |
| } |
Run API tests with Pytest, FastAPI and Async SQLAlchemy.
Changes made in test functions are not persisted to DB, even if
await session.commit() is called.
This allows tests to be independent,
able to run in parallel or in a shuffled order without
affecting the result.
This snippet does not include creation of DB tables, as I use Alembic for migration management and advise you to do the same (even in tests).
This guide explores advanced features of Pydantic, a powerful library for data validation and settings management in Python, leveraging type annotations. Aimed at enhancing backend development, it covers complex usage patterns, custom validation techniques, and integration strategies.
For basic user guide, follow the official documentation.