arcade-mcp/toolkits/math/tests/test_exponents.py
Eric Gustin c50699d5e6
Migrate OSS toolkits to MCPApp (#782)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Medium Risk**
> Touches multiple toolkits’ runtime entrypoints and context/error/auth
plumbing, so breakage risk is mainly around invocation/packaging and
tool execution wiring rather than business logic.
> 
> **Overview**
> Migrates the BrightData, ClickHouse, LinkedIn, Math, MongoDB,
Postgres, and Zendesk OSS toolkits from `arcade-tdk` to
`arcade-mcp-server` APIs by updating tool decorators, `Context` types,
auth classes, and exception imports.
> 
> Adds per-toolkit `__main__.py` files that construct an `MCPApp`,
register module tools, and run via configurable transport/host/port;
corresponding `pyproject.toml` updates bump versions, drop
`arcade-tdk`/`arcade-serve` deps, and add `project.scripts` console
entrypoints.
> 
> Updates tests and eval suites to use `arcade_mcp_server.Context`
(mocked) and switches eval `ToolCatalog` imports to `arcade_core`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9b3e31acb4b35e1d72efd47e2d279c5b19e3ecb0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-02-25 14:29:18 -08:00

41 lines
1.2 KiB
Python

import pytest
from arcade_mcp_server.exceptions import ToolExecutionError
from arcade_math.tools.exponents import (
log,
power,
)
def test_log():
assert log("8", "2") == "3.0"
assert log("2", "3") == "0.6309297535714574"
assert log("2", "0.5") == "-1.0"
with pytest.raises(ToolExecutionError):
log("-1", "0.5")
with pytest.raises(ToolExecutionError):
log("0", "10")
def test_power():
assert power("-8", "2") == "64"
assert power("0", "10") == "0"
assert (
power("2", "0.5") == "1.41421356237309504880168872420969807856"
"9671875376948073176679737990732478462107038850387534327641573"
)
assert power("2", "3") == "8"
assert (
power("2.", "-0.5") == "0.707106781186547524400844362104849039"
"2848359376884740365883398689953662392310535194251937671638207864"
)
assert (
power("2.1234", "0.6") == "1.571155202490495156807227174573016145"
"282682479346448636509576776014844055570115193494685328114403375"
)
assert power("2.1234", "1") == "2.1234"
assert power("2.1234", "3") == "9.574044440904"
assert power("8", "-2") == "0.015625"
assert power("8", "2") == "64"
with pytest.raises(ToolExecutionError):
power("-1", "0.5")