Skip to main content
Glama
test_plot_chart.py1.18 kB
import matplotlib matplotlib.use("Agg") import pytest from collections.abc import Sequence from fastmcp.utilities.types import Image as FastImage from fmcp.mpl_mcp.core.plot_chart import plot_chart def test_plot_chart_line_and_png(): x = [0.0, 1.0, 2.0, 3.0] y = [0.0, 1.0, 4.0, 9.0] img = plot_chart(x, y, plot_type="line", title="test", figsize=[6, 4]) assert isinstance(img, FastImage) assert isinstance(img.data, (bytes, bytearray)) assert img.data[:8] == b"\x89PNG\r\n\x1a\n" def test_plot_chart_scatter_and_bar_and_invalid(): x = [0.0, 1.0, 2.0, 3.0] y = [1.0, 3.0, 2.0, 5.0] img_scatter = plot_chart(x, y, plot_type="scatter", figsize=[6, 4]) assert isinstance(img_scatter, FastImage) assert img_scatter.data is not None assert img_scatter.data[:8] == b"\x89PNG\r\n\x1a\n" img_bar = plot_chart(x, y, plot_type="bar", figsize=[6, 4]) assert isinstance(img_bar, FastImage) assert img_bar.data is not None assert img_bar.data[:8] == b"\x89PNG\r\n\x1a\n" with pytest.raises(ValueError): plot_chart([float(val) for val in x], [float(val) for val in y], plot_type="unknown", figsize=[6, 4])

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/abhiphile/fermat-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server