Name | fluent-assertions JSON |
Version |
0.1.4
JSON |
| download |
home_page | None |
Summary | Fluent API for assertions supporting pytest with focus on developer experience. |
upload_time | 2024-09-17 18:28:48 |
maintainer | None |
docs_url | None |
author | Victor Künstler |
requires_python | >=3.12 |
license | MIT License Copyright (c) 2024 Victor Künstler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
assertions
fluent
fluent assertions
fluentapi
pytest
testing
typing
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# fluent-assertions for Pytest
This project aims to provide a **fluent API** for assertions supporting **pytest**, designed with simplicity and ease of use in mind.
The core idea is to make writing assertions more intuitive, readable, and enjoyable by offering a fluent interface that leverages the power of modern Python **typing**. It aims to be easy to use in any IDE for enhanced developer productivity.
*⚠️ Current Status This project is in its early exploratory phase. While the core functionality is present, it is not yet fully mature. Use with caution as the API may evolve rapidly and changes could be breaking.*
## 🎯 Features
- Fluent API for pytest assertions.
- Full typing support for IDE-friendly development.
- Designed to improve readability and expressiveness of test cases.
## 🛠️ Examples
Classes:
```python
from fluent_assertions import assert_that
def test_class():
@dataclasses.dataclass
class User:
name: str
age: int
def get_name(self):
return self.name
list_of_users = [User(name="Guenther", age=51), User(name="Jack", age=12)]
(
assert_that(list_of_users)
.has_size(2)
.extracting(User.get_name)
.contains_exactly(["Guenther", "Jack"])
.last()
.is_equal_to("Jack")
)
```
Dictionaries:
```python
def test_dict():
example_dict = {
"name": "Guenther",
"age": "51",
}
(
assert_that(example_dict)
.is_not_empty()
.contains_keys(["name", "age"])
.contains_values(["Guenther", "51"])
)
```
Lists:
```python
def test_list():
(
assert_that([1, 2, 3])
.contains_only(1, 2, 3)
.has_size(3)
.contains_subsequence([2, 3])
)
```
## 📦 Installation
Available on PyPi:
```bash
pip install fluent-assertions
```
## 🤝 Contributing
Feedback and collaboration are highly encouraged! If you encounter bugs, have feature requests, or want to contribute improvements, feel free to open an issue or submit a pull request.
## 🚧 Roadmap
- Add more assertion types and methods.
- Improve documentation and add examples.
## 📜 License
This project is licensed under the MIT License. See the LICENSE file for more details.
Raw data
{
"_id": null,
"home_page": null,
"name": "fluent-assertions",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "assertions, fluent, fluent assertions, fluentAPI, pytest, testing, typing",
"author": "Victor K\u00fcnstler",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0e/c8/11cb890a804eab10c8ce6be527a104edf322075973e395f1dea469098aca/fluent_assertions-0.1.4.tar.gz",
"platform": null,
"description": "# fluent-assertions for Pytest\n\nThis project aims to provide a **fluent API** for assertions supporting **pytest**, designed with simplicity and ease of use in mind. \n\nThe core idea is to make writing assertions more intuitive, readable, and enjoyable by offering a fluent interface that leverages the power of modern Python **typing**. It aims to be easy to use in any IDE for enhanced developer productivity.\n\n\n*\u26a0\ufe0f Current Status This project is in its early exploratory phase. While the core functionality is present, it is not yet fully mature. Use with caution as the API may evolve rapidly and changes could be breaking.*\n\n\n## \ud83c\udfaf Features\n\n- Fluent API for pytest assertions.\n- Full typing support for IDE-friendly development.\n- Designed to improve readability and expressiveness of test cases.\n\n## \ud83d\udee0\ufe0f Examples\n\nClasses:\n```python\nfrom fluent_assertions import assert_that\n\ndef test_class(): \n @dataclasses.dataclass\n class User:\n name: str\n age: int\n \n def get_name(self):\n return self.name\n \n list_of_users = [User(name=\"Guenther\", age=51), User(name=\"Jack\", age=12)]\n (\n assert_that(list_of_users)\n .has_size(2)\n .extracting(User.get_name)\n .contains_exactly([\"Guenther\", \"Jack\"])\n .last()\n .is_equal_to(\"Jack\")\n )\n\n```\n\nDictionaries:\n```python\ndef test_dict():\n example_dict = {\n \"name\": \"Guenther\",\n \"age\": \"51\",\n }\n \n (\n assert_that(example_dict)\n .is_not_empty()\n .contains_keys([\"name\", \"age\"])\n .contains_values([\"Guenther\", \"51\"])\n )\n```\n\nLists:\n```python \ndef test_list():\n (\n assert_that([1, 2, 3])\n .contains_only(1, 2, 3)\n .has_size(3)\n .contains_subsequence([2, 3])\n )\n\n```\n\n## \ud83d\udce6 Installation\n\nAvailable on PyPi:\n\n```bash\npip install fluent-assertions\n```\n\n## \ud83e\udd1d Contributing\n\nFeedback and collaboration are highly encouraged! If you encounter bugs, have feature requests, or want to contribute improvements, feel free to open an issue or submit a pull request.\n\n## \ud83d\udea7 Roadmap\n\n- Add more assertion types and methods.\n- Improve documentation and add examples.\n\n\n## \ud83d\udcdc License\n\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n\n\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Victor K\u00fcnstler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Fluent API for assertions supporting pytest with focus on developer experience.",
"version": "0.1.4",
"project_urls": {
"Documentation": "https://victorkuenstler.github.io/fluent-assertions/fluent_assertions.html",
"Issues": "https://github.com/VictorKuenstler/fluent-assertions/issues",
"Repository": "https://github.com/VictorKuenstler/fluent-assertions.git"
},
"split_keywords": [
"assertions",
" fluent",
" fluent assertions",
" fluentapi",
" pytest",
" testing",
" typing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "77a07fb65cb8255e8619255c8ae651ef28d083d15262af8c7e0abf6557529913",
"md5": "706995f42396859128e721569a893212",
"sha256": "ba06ce58bcaa28a335c5e1c51913ab495b4001225d08f6278e9c7e8f33e3592b"
},
"downloads": -1,
"filename": "fluent_assertions-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "706995f42396859128e721569a893212",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 6132,
"upload_time": "2024-09-17T18:28:46",
"upload_time_iso_8601": "2024-09-17T18:28:46.522722Z",
"url": "https://files.pythonhosted.org/packages/77/a0/7fb65cb8255e8619255c8ae651ef28d083d15262af8c7e0abf6557529913/fluent_assertions-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0ec811cb890a804eab10c8ce6be527a104edf322075973e395f1dea469098aca",
"md5": "cc5e9facc0d6d57d94bb6235d8470e19",
"sha256": "fe9e895907cecd6129449391d5fe533eaf5a191cb7848b4576d5c520f1286fa1"
},
"downloads": -1,
"filename": "fluent_assertions-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "cc5e9facc0d6d57d94bb6235d8470e19",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 9359,
"upload_time": "2024-09-17T18:28:48",
"upload_time_iso_8601": "2024-09-17T18:28:48.110381Z",
"url": "https://files.pythonhosted.org/packages/0e/c8/11cb890a804eab10c8ce6be527a104edf322075973e395f1dea469098aca/fluent_assertions-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-17 18:28:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "VictorKuenstler",
"github_project": "fluent-assertions",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "fluent-assertions"
}