v0.4.2
- Fixed edge cases when loading typing.Dict, typing.List and typing.ClassVar (#74). In this release, we have implemented changes to improve the handling of edge cases related to the Python
typing.Dict
,typing.List
, andtyping.ClassVar
during serialization and deserialization of dataclasses and generic types. Specifically, we have modified the_marshal
and_unmarshal
functions to check for the__origin__
attribute to determine whether the type is aClassVar
and skip it if it is. The_marshal_dataclass
and_unmarshal_dataclass
functions now check for the__dataclass_fields__
attribute to ensure that only dataclass fields are marshaled and unmarshaled. We have also added a new unit test for loading a complex data class using theMockInstallation
class, which contains various attributes such as a string, a nested dictionary, a list ofPolicy
objects, and a dictionary mapping string keys toPolicy
objects. This test case checks that the installation object correctly serializes and deserializes theComplexClass
instance to and from JSON format according to the specified attribute types, including handling of thetyping.Dict
,typing.List
, andtyping.ClassVar
types. These changes improve the reliability and robustness of our library in handling complex data types defined in thetyping
module. MockPrompts.extend()
now returns a copy (#72). In the latest release, theextend()
method in theMockPrompts
class of thetui.py
module has been enhanced. Previously,extend()
would modify the originalMockPrompts
object, which could lead to issues when reusing the same object in multiple places within the same test, as its state would be altered each timeextend()
was called. This has been addressed by updating theextend()
method to return a copy of theMockPrompts
object with the updated patterns and answers, instead of modifying the original object. This change ensures that the originalMockPrompts
object can be securely reused in multiple test scenarios without unintended side effects, preserving the integrity of the original state. Furthermore, additional tests have been incorporated to verify the correct behavior of both the new and original prompts.
Contributors: @pritishpai, @nkvuong