From 8a7a4227a627f2a9dfa3edd51803a6b610d78a5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Sch=C3=A4fer?= <david.schaefer@ufz.de>
Date: Mon, 4 Mar 2024 09:01:49 +0100
Subject: [PATCH] enable pandas copy_on_write

---
 saqc/core/core.py          | 4 ++--
 tests/core/test_flags.py   | 2 +-
 tests/core/test_history.py | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/saqc/core/core.py b/saqc/core/core.py
index 1a1976fea..6ae5e48c5 100644
--- a/saqc/core/core.py
+++ b/saqc/core/core.py
@@ -12,7 +12,7 @@ import warnings
 from copy import copy as shallowcopy
 from copy import deepcopy
 from functools import partial
-from typing import Any, Hashable, Iterable, MutableMapping, overload
+from typing import Any, Hashable, Iterable, MutableMapping
 
 import numpy as np
 import pandas as pd
@@ -32,7 +32,7 @@ from saqc.funcs import FunctionsMixin
 
 # warnings
 pd.set_option("mode.chained_assignment", "warn")
-pd.options.mode.copy_on_write = False
+pd.set_option("mode.copy_on_write", True)
 np.seterr(invalid="ignore")
 
 
diff --git a/tests/core/test_flags.py b/tests/core/test_flags.py
index cc8949bf6..c9628d49c 100644
--- a/tests/core/test_flags.py
+++ b/tests/core/test_flags.py
@@ -122,7 +122,7 @@ def test_copy(data: Union[pd.DataFrame, DictOfSeries, Dict[str, pd.Series]]):
 
     # the underling series data is the same
     for c in shallow.columns:
-        assert shallow._data[c].index is flags._data[c].index
+        assert shallow._data[c].index.equals(flags._data[c].index)
 
     # the underling series data was copied
     for c in deep.columns:
diff --git a/tests/core/test_history.py b/tests/core/test_history.py
index e8279f462..cb3412c37 100644
--- a/tests/core/test_history.py
+++ b/tests/core/test_history.py
@@ -143,7 +143,7 @@ def test_copy(data):
     assert is_equal(deep, shallow)
 
     # underling pandas data was only copied with deep=True
-    assert shallow.hist.index is hist.hist.index
+    assert shallow.hist.index.equals(hist.hist.index)
     assert deep.hist.index is not hist.hist.index
 
 
-- 
GitLab