diff --git a/pandas/tests/groupby/test_nth.py b/pandas/tests/groupby/test_nth.py index 7912b4bf3bdf6..47e6e7839422a 100644 --- a/pandas/tests/groupby/test_nth.py +++ b/pandas/tests/groupby/test_nth.py @@ -153,8 +153,8 @@ def test_nth(self): expected = s.groupby(g).first() expected2 = s.groupby(g).apply(lambda x: x.iloc[0]) assert_series_equal(expected2, expected, check_names=False) - assert expected.name, 0 assert expected.name == 1 + assert expected2.name == 1 # validate first v = s[g == 1].iloc[0] diff --git a/pandas/tests/indexes/datetimes/test_tools.py b/pandas/tests/indexes/datetimes/test_tools.py index 61f7ac8abaf09..a47db755b44af 100644 --- a/pandas/tests/indexes/datetimes/test_tools.py +++ b/pandas/tests/indexes/datetimes/test_tools.py @@ -625,7 +625,7 @@ def test_to_datetime_iso8601(self): def test_to_datetime_default(self): rs = to_datetime('2001') xp = datetime(2001, 1, 1) - assert rs, xp + assert rs == xp # dayfirst is essentially broken diff --git a/pandas/tests/indexes/period/test_construction.py b/pandas/tests/indexes/period/test_construction.py index 6a188c0987f91..e5b889e100307 100644 --- a/pandas/tests/indexes/period/test_construction.py +++ b/pandas/tests/indexes/period/test_construction.py @@ -135,15 +135,15 @@ def test_constructor_fromarraylike(self): result = PeriodIndex(idx, freq=offsets.MonthEnd()) tm.assert_index_equal(result, idx) - assert result.freq, 'M' + assert result.freq == 'M' result = PeriodIndex(idx, freq='2M') tm.assert_index_equal(result, idx.asfreq('2M')) - assert result.freq, '2M' + assert result.freq == '2M' result = PeriodIndex(idx, freq=offsets.MonthEnd(2)) tm.assert_index_equal(result, idx.asfreq('2M')) - assert result.freq, '2M' + assert result.freq == '2M' result = PeriodIndex(idx, freq='D') exp = idx.asfreq('D', 'e') diff --git a/pandas/tests/indexes/test_range.py b/pandas/tests/indexes/test_range.py index d140a2503984e..c7af0954cf483 100644 --- a/pandas/tests/indexes/test_range.py +++ b/pandas/tests/indexes/test_range.py @@ -172,16 +172,16 @@ def test_constructor_name(self): copy = RangeIndex(orig) copy.name = 'copy' - assert orig.name, 'original' - assert copy.name, 'copy' + assert orig.name == 'original' + assert copy.name == 'copy' new = Index(copy) - assert new.name, 'copy' + assert new.name == 'copy' new.name = 'new' - assert orig.name, 'original' - assert new.name, 'copy' - assert new.name, 'new' + assert orig.name == 'original' + assert copy.name == 'copy' + assert new.name == 'new' def test_numeric_compat2(self): # validate that we are handling the RangeIndex overrides to numeric ops @@ -273,7 +273,7 @@ def test_repr(self): expected = "RangeIndex(start=0, stop=5, step=1, name='Foo')" else: expected = "RangeIndex(start=0, stop=5, step=1, name=u'Foo')" - assert result, expected + assert result == expected result = eval(result) tm.assert_index_equal(result, i, exact=True) diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index 92537059218d6..cff83c2ff0a3a 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -843,7 +843,7 @@ def test_to_weekly_resampling(self): tsplot(high, plt.Axes.plot) lines = tsplot(low, plt.Axes.plot) for l in lines: - assert PeriodIndex(data=l.get_xdata()).freq, idxh.freq + assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq @slow def test_from_weekly_resampling(self): @@ -858,7 +858,7 @@ def test_from_weekly_resampling(self): expected_l = np.array([1514, 1519, 1523, 1527, 1531, 1536, 1540, 1544, 1549, 1553, 1558, 1562], dtype=np.float64) for l in ax.get_lines(): - assert PeriodIndex(data=l.get_xdata()).freq, idxh.freq + assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq xdata = l.get_xdata(orig=False) if len(xdata) == 12: # idxl lines tm.assert_numpy_array_equal(xdata, expected_l) @@ -873,7 +873,7 @@ def test_from_weekly_resampling(self): tsplot(low, plt.Axes.plot) lines = tsplot(high, plt.Axes.plot) for l in lines: - assert PeriodIndex(data=l.get_xdata()).freq, idxh.freq + assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq xdata = l.get_xdata(orig=False) if len(xdata) == 12: # idxl lines tm.assert_numpy_array_equal(xdata, expected_l) diff --git a/pandas/tests/series/test_timeseries.py b/pandas/tests/series/test_timeseries.py index d5517bdcceac7..6018260708335 100644 --- a/pandas/tests/series/test_timeseries.py +++ b/pandas/tests/series/test_timeseries.py @@ -916,7 +916,7 @@ def test_from_M8_structured(self): assert df['Forecasting'][0] == dates[0][1] s = Series(arr['Date']) - assert s[0], Timestamp + assert isinstance(s[0], Timestamp) assert s[0] == dates[0][0] s = Series.from_array(arr['Date'], Index([0])) diff --git a/pandas/tests/test_lib.py b/pandas/tests/test_lib.py index df97095035952..6be687e26e985 100644 --- a/pandas/tests/test_lib.py +++ b/pandas/tests/test_lib.py @@ -13,15 +13,15 @@ class TestMisc(object): def test_max_len_string_array(self): arr = a = np.array(['foo', 'b', np.nan], dtype='object') - assert lib.max_len_string_array(arr), 3 + assert lib.max_len_string_array(arr) == 3 # unicode arr = a.astype('U').astype(object) - assert lib.max_len_string_array(arr), 3 + assert lib.max_len_string_array(arr) == 3 # bytes for python3 arr = a.astype('S').astype(object) - assert lib.max_len_string_array(arr), 3 + assert lib.max_len_string_array(arr) == 3 # raises pytest.raises(TypeError, diff --git a/pandas/tests/test_strings.py b/pandas/tests/test_strings.py index f28a5926087ac..bb31fb9260160 100644 --- a/pandas/tests/test_strings.py +++ b/pandas/tests/test_strings.py @@ -2102,12 +2102,12 @@ def test_split_with_name(self): idx = Index(['a,b', 'c,d'], name='xxx') res = idx.str.split(',') exp = Index([['a', 'b'], ['c', 'd']], name='xxx') - assert res.nlevels, 1 + assert res.nlevels == 1 tm.assert_index_equal(res, exp) res = idx.str.split(',', expand=True) exp = MultiIndex.from_tuples([('a', 'b'), ('c', 'd')]) - assert res.nlevels, 2 + assert res.nlevels == 2 tm.assert_index_equal(res, exp) def test_partition_series(self): @@ -2247,13 +2247,13 @@ def test_partition_with_name(self): idx = Index(['a,b', 'c,d'], name='xxx') res = idx.str.partition(',') exp = MultiIndex.from_tuples([('a', ',', 'b'), ('c', ',', 'd')]) - assert res.nlevels, 3 + assert res.nlevels == 3 tm.assert_index_equal(res, exp) # should preserve name res = idx.str.partition(',', expand=False) exp = Index(np.array([('a', ',', 'b'), ('c', ',', 'd')]), name='xxx') - assert res.nlevels, 1 + assert res.nlevels == 1 tm.assert_index_equal(res, exp) def test_pipe_failures(self):