fix: update data validation in Data model (#6789)

* fix: enhance data validation in Data model

* fix: Add warning for invalid data format in Data schema

Modify data validation to log a warning when data is not a dictionary, preparing for a future error in version 1.3.0

* ✅ (test_data_class.py): add assertion to check if data attribute is an empty dictionary after calling get_text() method

* 🐛 (data.py): fix issue where values["data"] could be None, causing potential errors in the code. Now ensuring "data" key exists and is initialized as an empty dictionary if it is not present.

---------

Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-03-05 10:49:23 -03:00 • committed by GitHub
commit 8f4515e655
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View file

@ -138,3 +138,4 @@ def test_get_text_with_none_data():
schema = Data(data=data, text_key="text", default_value="default")
result = schema.get_text()
assert result == "default"
assert schema.data == {}