Skip to content

Commit

Permalink
Fix typos in test_interval_new (pandas-dev#20026)
Browse files Browse the repository at this point in the history
  • Loading branch information
jschendel authored and jreback committed Mar 7, 2018
1 parent 5782ab8 commit 460941f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pandas/tests/indexing/interval/test_interval_new.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
import numpy as np
import pandas as pd

from pandas import Series, IntervalIndex, Interval
import pandas.util.testing as tm
Expand Down Expand Up @@ -170,17 +169,17 @@ def test_loc_with_overlap(self):

# interval
expected = 0
result = s.loc[pd.interval(1, 5)]
result = s.loc[Interval(1, 5)]
tm.assert_series_equal(expected, result)

result = s[pd.interval(1, 5)]
result = s[Interval(1, 5)]
tm.assert_series_equal(expected, result)

expected = s
result = s.loc[[pd.interval(1, 5), pd.Interval(3, 7)]]
result = s.loc[[Interval(1, 5), Interval(3, 7)]]
tm.assert_series_equal(expected, result)

result = s[[pd.interval(1, 5), pd.Interval(3, 7)]]
result = s[[Interval(1, 5), Interval(3, 7)]]
tm.assert_series_equal(expected, result)

with pytest.raises(KeyError):
Expand All @@ -197,17 +196,17 @@ def test_loc_with_overlap(self):

# slices with interval (only exact matches)
expected = s
result = s.loc[pd.interval(1, 5):pd.Interval(3, 7)]
result = s.loc[Interval(1, 5):Interval(3, 7)]
tm.assert_series_equal(expected, result)

result = s[pd.interval(1, 5):pd.Interval(3, 7)]
result = s[Interval(1, 5):Interval(3, 7)]
tm.assert_series_equal(expected, result)

with pytest.raises(KeyError):
s.loc[pd.interval(1, 6):pd.Interval(3, 8)]
s.loc[Interval(1, 6):Interval(3, 8)]

with pytest.raises(KeyError):
s[pd.interval(1, 6):pd.Interval(3, 8)]
s[Interval(1, 6):Interval(3, 8)]

# slices with scalar raise for overlapping intervals
# TODO KeyError is the appropriate error?
Expand All @@ -217,7 +216,7 @@ def test_loc_with_overlap(self):
def test_non_unique(self):

idx = IntervalIndex.from_tuples([(1, 3), (3, 7)])
s = pd.Series(range(len(idx)), index=idx)
s = Series(range(len(idx)), index=idx)

result = s.loc[Interval(1, 3)]
assert result == 0
Expand Down

0 comments on commit 460941f

Please sign in to comment.