Skip to content

Commit 8b4d6f6

Browse files
authored
Merge pull request #1067 from romainx/test_improvements
Added basic tests on some important components
2 parents 584e9ab + 730b96b commit 8b4d6f6

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

scipy-notebook/test/test_pandas.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
3+
import logging
4+
5+
import pytest
6+
7+
LOGGER = logging.getLogger(__name__)
8+
9+
10+
@pytest.mark.parametrize(
11+
"name,command",
12+
[
13+
(
14+
"Sum series",
15+
"import pandas as pd; import numpy as np; np.random.seed(0); print(pd.Series(np.random.randint(0, 7, size=10)).sum())",
16+
),
17+
],
18+
)
19+
def test_pandas(container, name, command):
20+
"""Basic pandas tests"""
21+
LOGGER.info(f"Testing pandas: {name} ...")
22+
c = container.run(tty=True, command=["start.sh", "python", "-c", command])
23+
rv = c.wait(timeout=30)
24+
assert rv == 0 or rv["StatusCode"] == 0
25+
logs = c.logs(stdout=True).decode("utf-8")
26+
LOGGER.debug(logs)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
3+
import logging
4+
5+
import pytest
6+
7+
LOGGER = logging.getLogger(__name__)
8+
9+
10+
@pytest.mark.parametrize(
11+
"name,command",
12+
[
13+
(
14+
"Hello world",
15+
"import tensorflow as tf;print(tf.constant('Hello, TensorFlow'))",
16+
),
17+
(
18+
"Sum",
19+
"import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))",
20+
),
21+
],
22+
)
23+
def test_tensorflow(container, name, command):
24+
"""Basic tensorflow tests"""
25+
LOGGER.info(f"Testing tensorflow: {name} ...")
26+
c = container.run(tty=True, command=["start.sh", "python", "-c", command])
27+
rv = c.wait(timeout=30)
28+
assert rv == 0 or rv["StatusCode"] == 0
29+
logs = c.logs(stdout=True).decode("utf-8")
30+
LOGGER.debug(logs)

0 commit comments

Comments
 (0)