Skip to main content

Guará

PyPI Downloads

Guará is a Python framework for business logic expression. It allows you to write production code and tests as executable domain language, combining:

  • Business Logic Language → expresses domain behavior using Ubiquitous Language (DDD)
  • Test Framework → orchestrates scenarios using Given / When / Then

Instead of focusing only on technical assertions, Guará enables you to describe business scenarios as code, making production code and tests readable by developers and domain experts.

Core Idea

Guará turns code into business narratives:

  • Transactions → represent actions (use cases)
  • Assertions (it) → represent business expectations
  • Application DSL → orchestrates flows in domain language

Syntax

Application.when(DoSomething [,with_parameter=value, ...]).expects(it.Matches, a_condition)

Example in Action

Modeling

from guara.application import Application
from guara import it
from transactions import HasBalance, BuyAsset, UpdatePortfolio


def main():
    finance_app = Application()
    (
        finance_app.given(HasBalance)
        .when(BuyAsset, symbol="AAPL", amount=2000)
        .and_(UpdatePortfolio)
        .expects(it.IsEqualTo, 20)
    )

UI Testing

from guara.application import Application
from guara import it
from selenium import webdriver
from transactions import OpenApp, ChangeToPortuguese, NavigateToInfoPage, CloseApp


def test_sample_web_page():
    app = Application(webdriver.Chrome())
    app.given(OpenApp, url="https://anyhost.com/")
    app.when(ChangeToPortuguese).expects(it.IsEqualTo, CONTENT_IN_PORTUGUESE)
    app.when(NavigateToInfoPage).then(it.Contains, "This project was born")
    app.execute(CloseApp)

Documentation

For more information, check: https://guara.readthedocs.io/en/latest/

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guara-0.0.25.tar.gz (920.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guara-0.0.25-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file guara-0.0.25.tar.gz.

File metadata

  • Download URL: guara-0.0.25.tar.gz
  • Upload date:
  • Size: 920.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for guara-0.0.25.tar.gz
Algorithm Hash digest
SHA256 5b369279020c53aa9544d22266679815cb7667e549f433c96db50c21179c54fb
MD5 b8322912ee23cf4a53ab2fe3138670ff
BLAKE2b-256 bf816810104da996cb815bed95fb9b36d9a1ce4cb403788857fcb3fd3caa5fe8

See more details on using hashes here.

File details

Details for the file guara-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: guara-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for guara-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 6c18ddc13a6fb30d014ae61606d9efafafebbad3c953c2e5ffda35272afe5bda
MD5 fc1d21945af692cc79a6d7ec658e14b6
BLAKE2b-256 fef36f674a18341ce784598e3704a3c5e61b4c3dc3b49164a2c5d43e715af410

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page