Metadata-Version: 2.3
Name: fluent-assertions
Version: 0.1.4
Summary: Fluent API for assertions supporting pytest with focus on developer experience.
Project-URL: Repository, https://github.com/VictorKuenstler/fluent-assertions.git
Project-URL: Issues, https://github.com/VictorKuenstler/fluent-assertions/issues
Project-URL: Documentation, https://victorkuenstler.github.io/fluent-assertions/fluent_assertions.html
Author: Victor Künstler
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.
License-File: LICENSE
Keywords: assertions,fluent,fluent assertions,fluentAPI,pytest,testing,typing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.12
Requires-Dist: pytest>=7.0.0
Description-Content-Type: text/markdown

# 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.


