tests_uaerrors.py
Go to the documentation of this file.
1 import unittest
2 import opcua.ua.uaerrors as uaerrors
3 from opcua.ua.uaerrors import UaStatusCodeError
4 
5 class TestUaErrors(unittest.TestCase):
6  status_code_bad_internal = 0x80020000
7  status_code_unknown = "Definitely Not A Status Code"
8 
9  def setUp(self):
10  self.direct = uaerrors.BadInternalError()
11  self.indirect = UaStatusCodeError(self.status_code_bad_internal)
12  self.unknown = UaStatusCodeError(self.status_code_unknown)
13 
15  self.assertIs(type(self.direct), uaerrors.BadInternalError)
16  self.assertIs(type(self.indirect), uaerrors.BadInternalError)
17  self.assertIs(type(self.unknown), UaStatusCodeError)
18 
19  def test_code(self):
20  self.assertEqual(self.direct.code, self.status_code_bad_internal)
21  self.assertEqual(self.indirect.code, self.status_code_bad_internal)
22  self.assertEqual(self.unknown.code, self.status_code_unknown)
23 
24  def test_string_repr(self):
25  self.assertIn("BadInternal", str(self.direct))
26  self.assertIn("BadInternal", str(self.indirect))


ros_opcua_impl_python_opcua
Author(s): Denis Štogl , Daniel Draper
autogenerated on Tue Jan 19 2021 03:12:44