11# -*- coding: utf-8 -*-
22
33from datetime import timedelta
4- from distutils .version import LooseVersion
54
65import numpy as np
76import pytest
@@ -197,15 +196,13 @@ def test_ops_ndarray(self):
197196 other = pd .to_timedelta (['1 day' ]).values
198197 expected = pd .to_timedelta (['2 days' ]).values
199198 tm .assert_numpy_array_equal (td + other , expected )
200- if LooseVersion (np .__version__ ) >= LooseVersion ('1.8' ):
201- tm .assert_numpy_array_equal (other + td , expected )
199+ tm .assert_numpy_array_equal (other + td , expected )
202200 pytest .raises (TypeError , lambda : td + np .array ([1 ]))
203201 pytest .raises (TypeError , lambda : np .array ([1 ]) + td )
204202
205203 expected = pd .to_timedelta (['0 days' ]).values
206204 tm .assert_numpy_array_equal (td - other , expected )
207- if LooseVersion (np .__version__ ) >= LooseVersion ('1.8' ):
208- tm .assert_numpy_array_equal (- other + td , expected )
205+ tm .assert_numpy_array_equal (- other + td , expected )
209206 pytest .raises (TypeError , lambda : td - np .array ([1 ]))
210207 pytest .raises (TypeError , lambda : np .array ([1 ]) - td )
211208
@@ -217,21 +214,18 @@ def test_ops_ndarray(self):
217214
218215 tm .assert_numpy_array_equal (td / other ,
219216 np .array ([1 ], dtype = np .float64 ))
220- if LooseVersion (np .__version__ ) >= LooseVersion ('1.8' ):
221- tm .assert_numpy_array_equal (other / td ,
222- np .array ([1 ], dtype = np .float64 ))
217+ tm .assert_numpy_array_equal (other / td ,
218+ np .array ([1 ], dtype = np .float64 ))
223219
224220 # timedelta, datetime
225221 other = pd .to_datetime (['2000-01-01' ]).values
226222 expected = pd .to_datetime (['2000-01-02' ]).values
227223 tm .assert_numpy_array_equal (td + other , expected )
228- if LooseVersion (np .__version__ ) >= LooseVersion ('1.8' ):
229- tm .assert_numpy_array_equal (other + td , expected )
224+ tm .assert_numpy_array_equal (other + td , expected )
230225
231226 expected = pd .to_datetime (['1999-12-31' ]).values
232227 tm .assert_numpy_array_equal (- td + other , expected )
233- if LooseVersion (np .__version__ ) >= LooseVersion ('1.8' ):
234- tm .assert_numpy_array_equal (other - td , expected )
228+ tm .assert_numpy_array_equal (other - td , expected )
235229
236230 def test_tdi_ops_attributes (self ):
237231 rng = timedelta_range ('2 days' , periods = 5 , freq = '2D' , name = 'x' )
0 commit comments