Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some missing exception tests for base.py #734

Merged
merged 2 commits into from
Sep 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions databricks/koalas/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,9 @@ def test_all(self):

self.assert_eq(kdf.all(), pdf.all())

with self.assertRaisesRegex(ValueError, 'axis should be either 0 or "index" currently.'):
kdf.all(axis=1)

def test_any(self):
pdf = pd.DataFrame({
'col1': [False, False, False],
Expand All @@ -1398,6 +1401,9 @@ def test_any(self):

self.assert_eq(kdf.any(), pdf.any())

with self.assertRaisesRegex(ValueError, 'axis should be either 0 or "index" currently.'):
kdf.any(axis=1)

def test_rank(self):
pdf = pd.DataFrame(data={'col1': [1, 2, 3, 1], 'col2': [3, 4, 3, 1]},
columns=['col1', 'col2'])
Expand Down
6 changes: 6 additions & 0 deletions databricks/koalas/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,3 +621,9 @@ def test_shift(self):
repr(pser.shift(periods=2, fill_value=0)))
with self.assertRaisesRegex(ValueError, 'periods should be an int; however'):
kser.shift(periods=1.5)

def test_astype(self):
pser = pd.Series([10, 20, 15, 30, 45], name='x')
kser = koalas.Series(pser)
with self.assertRaisesRegex(ValueError, 'Type int63 not understood'):
kser.astype('int63')
7 changes: 7 additions & 0 deletions databricks/koalas/tests/test_series_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ def test_subtraction(self):

self.assertEqual(list(kdf['diff_seconds'].toPandas()), [35545499, 33644699, 31571099])

kdf = ks.from_pandas(pd.DataFrame({
'a': pd.date_range('2016-12-31', '2017-01-08', freq='D'),
'b': pd.Series(range(9))}))
expected_error_message = 'datetime subtraction can only be applied to datetime series.'
with self.assertRaisesRegex(TypeError, expected_error_message):
kdf['a'] - kdf['b']

@unittest.skip(
"It fails in certain OSs presumably due to different "
"timezone behaviours inherited from C library.")
Expand Down