napistu 0.3.7__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tests/test_utils.py CHANGED
@@ -2,9 +2,10 @@ from __future__ import annotations
2
2
 
3
3
  import gzip
4
4
  import os
5
+ import tempfile
5
6
  from datetime import datetime
6
- from unittest.mock import Mock
7
- from unittest.mock import patch
7
+ from pathlib import Path
8
+ from unittest.mock import Mock, patch
8
9
 
9
10
  import numpy as np
10
11
  import pandas as pd
@@ -705,3 +706,26 @@ def test_update_pathological_names():
705
706
  s3 = pd.Series(["foo", "bar", "baz"])
706
707
  out3 = utils.update_pathological_names(s3, "prefix_")
707
708
  assert list(out3) == ["foo", "bar", "baz"]
709
+
710
+
711
+ def test_parquet_save_load():
712
+ """Test that write_parquet and read_parquet work correctly."""
713
+ # Create test DataFrame
714
+ original_df = pd.DataFrame(
715
+ {
716
+ "sc_id_origin": ["A", "B", "C"],
717
+ "sc_id_dest": ["B", "C", "A"],
718
+ "path_length": [1, 2, 3],
719
+ "path_weights": [0.1, 0.5, 0.8],
720
+ "has_connection": [True, False, True],
721
+ }
722
+ )
723
+
724
+ # Write and read using temporary file
725
+ with tempfile.TemporaryDirectory() as temp_dir:
726
+ file_path = Path(temp_dir) / "test.parquet"
727
+ utils.save_parquet(original_df, file_path)
728
+ result_df = utils.load_parquet(file_path)
729
+
730
+ # Verify they're identical
731
+ pd.testing.assert_frame_equal(original_df, result_df)