Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed Module Update using 'moschitta-core' #1

Open
skyler-saville opened this issue May 23, 2024 · 0 comments
Open

Proposed Module Update using 'moschitta-core' #1

skyler-saville opened this issue May 23, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@skyler-saville
Copy link
Member

.serialize(data)
assert result == '{"name": "John", "age": 30}'

def test_deserialize(serializer):
data = '{"name": "John", "age": 30}'
result = serializer.deserialize(data)
assert result == {"name": "John", "age": 30}


**Tests for `MessagePackSerializer`**

```python
# test_msgpack_serializer.py
import pytest
from moschitta_serialization.msgpack_serializer import MessagePackSerializer

@pytest.fixture
def serializer():
    return MessagePackSerializer()

def test_serialize(serializer):
    data = {"name": "John", "age": 30}
    result = serializer.serialize(data)
    assert result == b'\x82\xa4name\xa4John\xa3age\x1e'

def test_deserialize(serializer):
    data = b'\x82\xa4name\xa4John\xa3age\x1e'
    result = serializer.deserialize(data)
    assert result == {"name": "John", "age": 30}

Tests for YAMLSerializer

# test_yaml_serializer.py
import pytest
from moschitta_serialization.yaml_serializer import YAMLSerializer

@pytest.fixture
def serializer():
    return YAMLSerializer()

def test_serialize(serializer):
    data = {"name": "John", "age": 30}
    result = serializer.serialize(data)
    assert result == "age: 30\nname: John\n"

def test_deserialize(serializer):
    data = "age: 30\nname: John\n"
    result = serializer.deserialize(data)
    assert result == {"name": "John", "age": 30}

Conclusion

The integration of moschitta-core into moschitta-serialization enhances the module by utilizing standardized base classes and configuration management. This ensures a consistent and efficient development process across the Moschitta Framework, adhering to the core principles of modularity, pythonic design, and lightweight architecture. The updated documentation and implementation reflect these improvements, providing a clear and coherent guide for developers using the moschitta-serialization module.

@skyler-saville skyler-saville added documentation Improvements or additions to documentation enhancement New feature or request labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant