frappy/test/test_errors.py
Markus Zolliker c0704b3d4f split BadValue into WrongType and RangeError
in order to match SECoP specification

fixes #4668

Change-Id: Ica73a8171536ccc324cf8db915347a6263c2d736
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/30625
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
2023-04-21 16:16:40 +02:00

37 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************
"""test data types."""
import frappy.errors
from frappy.errors import EXCEPTIONS, SECoPError
def test_errors():
"""check consistence of frappy.errors.EXCEPTIONS"""
for e in EXCEPTIONS.values():
assert EXCEPTIONS[e().name] == e
# check that all defined secop errors are in EXCEPTIONS
for cls in frappy.errors.__dict__.values():
if isinstance(cls, type) and issubclass(cls, SECoPError):
if cls != SECoPError:
assert cls().name in EXCEPTIONS