Skip to content

Commit

Permalink
fix up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CommonClimate committed Feb 27, 2023
1 parent eecbc4c commit 4501dd2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pyleoclim/tests/test_core_MultipleSeries.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,23 +495,23 @@ def test_remove_overload(self):
assert ms.series_list[0].equals(ts1) == (True, True)

class TestToPandas:
def test_to_pandas(self):
def test_to_pandas_with_common_time(self):
ts1 = pyleo.Series(time=np.array([1, 2, 4]), value=np.array([7, 4, 9]), time_unit='years CE', label='foo')
ts2 = pyleo.Series(time=np.array([1, 3, 4]), value=np.array([7, 8, 1]), time_unit='years CE', label='bar')
ms = pyleo.MultipleSeries([ts1, ts2])
result = ms.to_pandas()
result = ms.to_pandas(use_common_time=True)
expected_index = pd.DatetimeIndex(
np.array(['0000-12-31 05:48:45', '0002-07-02 02:31:54'], dtype='datetime64[s]'),
name='datetime',
)
expected = pd.DataFrame({'foo': [7, 5.25], 'bar': [7, 7.75]}, index=expected_index)
pd.testing.assert_frame_equal(result, expected)

def test_to_pandas_no_use_common_time(self):
def test_to_pandas_defau(self):
ts1 = pyleo.Series(time=np.array([1, 2, 4]), value=np.array([7, 4, 9]), time_unit='years CE', label='foo')
ts2 = pyleo.Series(time=np.array([1, 3, 4]), value=np.array([7, 8, 1]), time_unit='years CE', label='bar')
ms = pyleo.MultipleSeries([ts1, ts2])
result = ms.to_pandas(use_common_time=False)
result = ms.to_pandas()
expected_index = pd.DatetimeIndex(
np.array(['0000-12-31 05:48:45', '0001-12-31 11:37:31', '0002-12-31 17:26:17', '0003-12-31 23:15:03'],
dtype='datetime64[s]'),
Expand All @@ -522,10 +522,10 @@ def test_to_pandas_no_use_common_time(self):
pd.testing.assert_frame_equal(result, expected)

def test_to_pandas_args_kwargs(self):
ts1 = pyleo.Series(time=np.array([1, 2, 4]), value=np.array([7, 4, 9]), time_unit='years CE', label='foo')
ts2 = pyleo.Series(time=np.array([1, 3, 4]), value=np.array([7, 8, 1]), time_unit='years CE', label='bar')
ts1 = pyleo.Series(time=np.array([1, 2, 4]), value=np.array([7, 4, 9]), time_unit='years CE', label='foo',verbose=False)
ts2 = pyleo.Series(time=np.array([1, 3, 4]), value=np.array([7, 8, 1]), time_unit='years CE', label='bar',verbose=False)
ms = pyleo.MultipleSeries([ts1, ts2])
result = ms.to_pandas('bin', start=2)
result = ms.to_pandas('bin', use_common_time=True, start=2)
expected_index = pd.DatetimeIndex(
np.array(['0002-12-31 17:26:17'], dtype='datetime64[s]'),
name='datetime',
Expand Down

0 comments on commit 4501dd2

Please sign in to comment.