Skip to content

Commit f4c6aaf

Browse files
Refactor serialization to use CSV for pandas DataFrames (#9)
Refactor the serialization process to utilize `PandasCsvSerializer` for handling pandas DataFrames, enhance documentation, and improve test coverage. Update the CHANGELOG and README to reflect the new CSV support and version bump to 0.7.0. Fix typos in docstrings across multiple files.
2 parents 6e6935b + 4f76a14 commit f4c6aaf

File tree

49 files changed

+1563
-32
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1563
-32
lines changed

.github/workflows/continuous_integration.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ jobs:
6262
uv venv
6363
source .venv/bin/activate
6464
DIST_FILE=$(ls dist/snappylapy-*.tar.gz | head -n 1)
65-
uv pip install "snappylapy@$DIST_FILE"
65+
if [ "${{ matrix.include-extras }}" = "true" ]; then
66+
uv pip install "snappylapy[all]@$DIST_FILE"
67+
else
68+
uv pip install "snappylapy@$DIST_FILE"
69+
fi
6670
6771
# Remove the snappylapy folder to ensure the installed package is used for the test
6872
- name: Remove snappylapy folder in the cloned repository

.vscode/launch.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python Debugger: Current File",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal",
13+
"cwd": "${workspaceFolder}",
14+
"env": {
15+
"PYTHONPATH": "${workspaceFolder}"
16+
}
17+
},
18+
// Run current file as a module such relative imports work
19+
{
20+
"name": "Python Debugger: Current File as Module",
21+
"type": "debugpy",
22+
"request": "launch",
23+
"module": "snappylapy.${fileBasenameNoExtension}",
24+
"console": "integratedTerminal",
25+
"cwd": "${workspaceFolder}",
26+
"env": {
27+
"PYTHONPATH": "${workspaceFolder}"
28+
}
29+
},
30+
{
31+
"name": "Python Debugger: pytest",
32+
"type": "debugpy",
33+
"request": "launch",
34+
"program": "debug.py",
35+
"args": [
36+
37+
],
38+
"console": "integratedTerminal",
39+
"justMyCode": true,
40+
"cwd": "${workspaceFolder}",
41+
"env": {
42+
"PYTHONPATH": "${workspaceFolder}"
43+
}
44+
}
45+
]
46+
}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
33

44
*NOTE:* Version 0.X.X might have breaking changes in bumps of the minor version number. This is because the project is still in early development and the API is not yet stable. It will still be marked clearly in the release notes.
55

6+
## [0.7.0] - 2025-08-27
7+
- 🆕 Added csv serializer for pandas dataframes for making the deserialization work on windows and make a more suitable and human readable format.
8+
69
## [0.6.1] - 2025-08-25
710
- 🐞 Improve the handling of comparing large snapshots with test results. Snappylapy should be working well on large data structures. Disable the pytest assertion rewrite for large comparisons.
811

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Snappylapy
22

3-
Welcome to **Snappylapy**, a powerful and intuitive snapshot testing plugin for Python's pytest framework. Snappylapy simplifies the process of capturing and verifying snapshots of your data, ensuring your code behaves as expected across different runs. With Snappylapy, you can save snapshots in a human-readable format and deserialize them for robust integration testing, providing a clear separation layer to help isolate errors and maintain code integrity.
3+
Welcome to **Snappylapy**, a powerful and intuitive snapshot testing plugin for Python's pytest framework. Snappylapy simplifies the process of capturing and verifying snapshots of your data, ensuring your code behaves as expected across different runs. With Snappylapy, you can save snapshots in a human-readable format and deserialize them for robust integration testing, providing a clear separation layer to help isolate errors and maintain code integrity.
4+
5+
Snappylapy is following the api-style of the very popular Jest testing framework, making it familiar and easy to use for JavaScript developers.
46

57
## Installation
68
To get started with Snappylapy, install the package via pip, uv or poetry:
@@ -64,7 +66,7 @@ import pytest
6466
from snappylapy import Expect, LoadSnapshot
6567

6668
def test_snapshot_dict(expect: Expect):
67-
"""Test snapshot with dictionary data.****"""
69+
"""Test snapshot with dictionary data."""
6870
expect({
6971
"name": "John Doe",
7072
"age": 31
@@ -109,6 +111,7 @@ Registers pytest fixtures:
109111
Supported data types
110112
- ✅ .txt - if you provide a string
111113
- ✅ .json - for all other objects
114+
- ✅ .csv - for pandas DataFrames
112115
- ✅ custom (decode the data yourself and provide a file extension)
113116

114117
### Supported data types to snapshot test

0 commit comments

Comments
 (0)