Skip to content

Commit

Permalink
increase coverage
Browse files Browse the repository at this point in the history
Also remove tests from coverage
  • Loading branch information
mrocklin committed Oct 9, 2017
1 parent eb687ad commit b310333
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -8,6 +8,7 @@ omit =
# ignore _version.py and versioneer.py
.*version.*
*_version.py
*/test_*.py

exclude_lines =
if __name__ == '__main__':
11 changes: 0 additions & 11 deletions streamz/dataframe.py
Expand Up @@ -325,17 +325,6 @@ def _accumulate_groupby_mean(accumulator, new, grouper=None, index=None):
return (sums, counts), sums / counts


def _roll(accumulator, new, window, min_periods):
accumulator = pd.concat([accumulator, new])
if isinstance(window, int):
accumulator = accumulator.iloc[-window:]
elif isinstance(window, pd.Timedelta):
accumulator = accumulator.loc[(accumulator.index.max() - window):]

out = accumulator if len(accumulator) >= min_periods else []
return accumulator, out


_subtypes.append((pd.DataFrame, StreamingDataFrame))
_subtypes.append((pd.Series, StreamingSeries))

Expand Down
12 changes: 12 additions & 0 deletions streamz/tests/test_dataframes.py
Expand Up @@ -32,6 +32,18 @@ def test_identity():
assert assert_eq(L2[0], df.x)


def test_attributes():
df = pd.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
sdf = StreamingDataFrame(example=df)

assert 'x' in dir(sdf)
assert 'z' not in dir(sdf)

sdf.x
with pytest.raises(AttributeError):
sdf.z


def test_exceptions():
df = pd.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
sdf = StreamingDataFrame(example=df)
Expand Down

0 comments on commit b310333

Please sign in to comment.