semvec/pypi-packages huggingface dataset:
swapcoffee.tokens 1.0.4
A lightweight tokens.swap.coffee API Python wrapper
License: MIT
Requires Python: >=3.9
Keywords: asyncio, client, crypto, swapcoffee, ton, wrapper


#################
swapcoffee-tokens
#################

Installation
------------

..  code-block:: bash

    pip install -U swapcoffee-tokens

Simple example
--------------

.. code-block:: python

    import asyncio
    import logging

    from swapcoffee.tokens import SwapCoffee
    from swapcoffee.tokens.types import BlockchainToken


    async def main() -> None:
        logging.basicConfig(level=logging.DEBUG)
        coffee: SwapCoffee = SwapCoffee()
        tokens: list[BlockchainToken] = await coffee.get_tokens_by_symbols(symbols=["NOT", "DMT"])
        for token in tokens:
            logging.info("Token %s ($%s) costs %s USD", token.name, token.symbol, token.price_usd)
        await coffee.session.close()


    if __name__ == "__main__":
        asyncio.run(main())

Donations
---------
TON: `UQAYJ1terNmvoBh26Xi7tLa_P4t_OGMZOXBUfDB2mLMGuVMb`
USDT TRC20: `TGr2J3Pi6WmcexwmGFJDHLqrrhDoe2U6w6`
pytest-class-fixtures 0.1.0
Class as PyTest fixtures (and BDD steps)
License: MIT
Requires Python: <4.0,>=3.8

# `pytest-class-fixtures` — Object-oriented fixtures for pytest

## Turn your class into a fixture

Ever have PyTest ´s `@fixture` tell you this?

```
ValueError: class fixtures not supported (maybe in the future)
```

well, the future is now:

```python
from pytest_class_fixtures import class_fixture

@class_fixture(name="calc")
class Calculator:
    def __init__(self):
        self.result = 0

def test_calculator_initial_state(calc):
    assert calc.result == 0
```

Do you want [BDD](https://pytest-bdd.readthedocs.io/) with that?

```gherkin
# calculator.feature
Feature: Calculator
    Scenario: Addition
        Given the calculator is cleared
        When I add 5
        Then the result should be 5

```

```python
import pytest
from pytest_bdd import given, when, then, parsers, scenarios
from pytest_class_fixtures import class_fixture

scenarios("calculator.feature")

@class_fixture(name="calc")
class Calculator:
    def __init__ (self):
        self.clear()

    @given("the calculator is cleared")
    def clear (self):
        self.result = 0

    @when(parsers.parse("I add {number}"))
    def add (self, number):
        self.result += int(number)

@then(parsers.parse("the result should be {result}"))
def check_result(calc, result):
    assert calc.result == int(result)
```