Merge branch 'master' into asalikhov/automatic_conda_versioning

This commit is contained in:
Ayaz Salikhov
2021-06-29 02:28:53 +03:00
39 changed files with 504 additions and 391 deletions

View File

@@ -14,8 +14,11 @@ s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots()
ax.plot(t, s)
ax.set(xlabel='time (s)', ylabel='voltage (mV)',
title='About as simple as it gets, folks')
ax.set(
xlabel="time (s)",
ylabel="voltage (mV)",
title="About as simple as it gets, folks",
)
ax.grid()
# Note that the test can be run headless by checking if an image is produced
file_path = os.path.join("/tmp", "test.png")

View File

@@ -3,16 +3,22 @@ import matplotlib
import matplotlib.pyplot as plt
import os
matplotlib.rcParams['pgf.texsystem'] = 'pdflatex'
matplotlib.rcParams.update({'font.family': 'serif', 'font.size': 18,
'axes.labelsize': 20, 'axes.titlesize': 24,
'figure.titlesize': 28})
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams["pgf.texsystem"] = "pdflatex"
matplotlib.rcParams.update(
{
"font.family": "serif",
"font.size": 18,
"axes.labelsize": 20,
"axes.titlesize": 24,
"figure.titlesize": 28,
}
)
matplotlib.rcParams["text.usetex"] = True
fig, ax = plt.subplots(1, 1)
x = [1, 2]
y = [1, 2]
ax.plot(x, y, label='a label')
ax.plot(x, y, label="a label")
ax.legend(fontsize=15)
file_path = os.path.join("/tmp", "test_fonts.png")

View File

@@ -27,7 +27,7 @@ def test_check_extension(container, extension):
LOGGER.info(f"Checking the extension: {extension} ...")
c = container.run(
tty=True,
command=["start.sh", "jupyter", "labextension", "check", extension]
command=["start.sh", "jupyter", "labextension", "check", extension],
)
rv = c.wait(timeout=10)
logs = c.logs(stdout=True).decode("utf-8")

View File

@@ -13,9 +13,17 @@ THIS_DIR = os.path.dirname(os.path.realpath(__file__))
@pytest.mark.parametrize(
"test_file,expected_file,description",
[
("matplotlib_1.py", "test.png", "Test that matplotlib is able to plot a graph and write it as an image ..."),
("matplotlib_fonts_1.py", "test_fonts.png", "Test cm-super latex labels in matplotlib ...")
]
(
"matplotlib_1.py",
"test.png",
"Test that matplotlib is able to plot a graph and write it as an image ...",
),
(
"matplotlib_fonts_1.py",
"test_fonts.png",
"Test cm-super latex labels in matplotlib ...",
),
],
)
def test_matplotlib(container, test_file, expected_file, description):
"""Various tests performed on matplotlib

View File

@@ -1,32 +0,0 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import logging
import pytest
LOGGER = logging.getLogger(__name__)
@pytest.mark.parametrize(
"name,command_list",
[
(
"Sum series",
[
"import pandas as pd",
"import numpy as np",
"np.random.seed(0)",
"print(pd.Series(np.random.randint(0, 7, size=10)).sum())"
]
),
],
)
def test_pandas(container, name, command_list):
"""Basic pandas tests"""
LOGGER.info(f"Testing pandas: {name} ...")
command = ';'.join(command_list)
c = container.run(tty=True, command=["start.sh", "python", "-c", command])
rv = c.wait(timeout=30)
logs = c.logs(stdout=True).decode("utf-8")
LOGGER.debug(logs)
assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"

View File

@@ -0,0 +1,9 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import numpy as np
import pandas as pd
np.random.seed(0)
print(pd.Series(np.random.randint(0, 7, size=10)).sum())