Skip to content

Commit

Permalink
TST: misc test coverage #1245
Browse files Browse the repository at this point in the history
  • Loading branch information
Chang She authored and wesm committed May 26, 2012
1 parent e472dad commit b128759
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pandas/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def test_drop(self):

ser = Index([1,2,3])
dropped = ser.drop(1)
expected = Index([1,3])
expected = Index([2,3])
self.assert_(dropped.equals(expected))

def test_tuple_union_bug(self):
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,8 +1256,8 @@ def check_comparators(series, other):
check_comparators(self.ts, 5)
check_comparators(self.ts, self.ts + 1)

bool_ser = self.ts > 0
check_comparators(bool_ser, list(bool_ser[::2]))
#bool_ser = self.ts > 0
#check_comparators(bool_ser, list(bool_ser[::2]))


def test_operators_empty_int_corner(self):
Expand Down
14 changes: 9 additions & 5 deletions pandas/tseries/tests/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def test_fillna_nat(self):
assert_frame_equal(filled2, expected)


series = Series([NaT, 0, 1, 2], dtype='M8[us]')
series = Series([NaT, 0, 1, 2], dtype='M8[ns]')

filled = series.fillna(method='bfill')
filled2 = series.fillna(value=series[1])
Expand All @@ -396,7 +396,7 @@ def test_fillna_nat(self):
df = DataFrame({'A': series})
filled = df.fillna(method='bfill')
filled2 = df.fillna(value=series[1])
expected = DataFrame({'bfill': expected})
expected = DataFrame({'A': expected})
assert_frame_equal(filled, expected)
assert_frame_equal(filled2, expected)

Expand Down Expand Up @@ -488,9 +488,10 @@ def test_index_to_datetime(self):
expected = DatetimeIndex(datetools.to_datetime(idx.values))
self.assert_(result.equals(expected))

idx = Index([datetime.today()], dtype=object)
today = datetime.today()
idx = Index([today], dtype=object)
result = idx.to_datetime()
expected = DatetimeIndex([datetime.today()])
expected = DatetimeIndex([today])
self.assert_(result.equals(expected))

def test_range_misspecified(self):
Expand Down Expand Up @@ -608,7 +609,10 @@ def test_repeat(self):
def test_at_time(self):
rng = date_range('1/1/2000', '1/5/2000', freq='5min')
ts = Series(np.random.randn(len(rng)), index=rng)
self.assert_(ts.at_time(rng[0]), ts.ix[0])
rs = ts.at_time(rng[1])
self.assert_((rs.index.hour == rng[1].hour).all())
self.assert_((rs.index.minute == rng[1].minute).all())
self.assert_((rs.index.second == rng[1].second).all())

df = DataFrame(np.random.randn(len(rng), 3), index=rng)

Expand Down
8 changes: 6 additions & 2 deletions pandas/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,14 @@ def makePeriodIndex(k):
dr = PeriodIndex(start=dt, periods=k, freq='B')
return dr

def makeTimeSeries(nper=N):
def makeTimeSeries(nper=None):
if nper is None:
nper = N
return Series(randn(nper), index=makeDateIndex(nper))

def makePeriodSeries(nper=N):
def makePeriodSeries(nper=None):
if nper is None:
nper = N
return Series(randn(nper), index=makePeriodIndex(nper))

def getTimeSeriesData():
Expand Down

0 comments on commit b128759

Please sign in to comment.