mirror of
https://github.com/zap-proto/spec.git
synced 2026-10-30 15:04:03 +00:00
- Add native .zap schema files (zap.zap, addressbook.zap) - Refactor Python bindings to zap_schema module - Add zapc schema compiler binary - Update Rust client/server/crypto/identity modules - Add release workflow and build scripts - Update TypeScript package configuration - Add LLM documentation for AI assistants
33 lines
966 B
Python
33 lines
966 B
Python
"""Tests for zap_schema.error module."""
|
|
|
|
import pytest
|
|
from zap_schema.error import ZapError
|
|
|
|
|
|
class TestZapError:
|
|
"""Tests for ZapError class."""
|
|
|
|
def test_zap_error_creation(self):
|
|
"""Test creating a ZapError."""
|
|
error = ZapError("Something went wrong")
|
|
assert str(error) == "Something went wrong"
|
|
|
|
def test_zap_error_is_exception(self):
|
|
"""Test ZapError is an Exception."""
|
|
error = ZapError("test")
|
|
assert isinstance(error, Exception)
|
|
|
|
def test_zap_error_raise_and_catch(self):
|
|
"""Test raising and catching ZapError."""
|
|
with pytest.raises(ZapError) as exc_info:
|
|
raise ZapError("test error")
|
|
|
|
assert "test error" in str(exc_info.value)
|
|
|
|
def test_zap_error_subclass_behavior(self):
|
|
"""Test ZapError can be caught as Exception."""
|
|
try:
|
|
raise ZapError("test")
|
|
except Exception as e:
|
|
assert isinstance(e, ZapError)
|