Skip to content

Commit

Permalink
TST: Remove defunct test_nowrite_df
Browse files Browse the repository at this point in the history
(Supposedly) pandas now returns a copy for `df.values`.
`df.to_numpy()` doesn't work either ... 🙄
  • Loading branch information
kernc committed Jan 21, 2025
1 parent 86e0127 commit 6319193
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions backtesting/test/_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,23 +584,6 @@ def test_max_tries(self):
**OPT_PARAMS)
self.assertEqual(len(heatmap), 6)

def test_nowrite_df(self):
# Test we don't write into passed data df by default.
# Important for copy-on-write in Backtest.optimize()
df = EURUSD.astype(float)
_ = df.values.ctypes.data # dummy call for the value to stabilize!
mem_addr = df.values.ctypes.data
assert mem_addr == df.values.ctypes.data

class S(SmaCross):
def init(self):
super().init()
assert mem_addr == self.data.df.values.ctypes.data, (mem_addr, self.data.df.values.ctypes.data)

bt = Backtest(df, S)
_ = bt.run()
assert mem_addr == bt._data.values.ctypes.data

def test_multiprocessing_windows_spawn(self):
df = GOOG.iloc[:100]
kw = {'fast': [10]}
Expand Down

0 comments on commit 6319193

Please sign in to comment.