Commit 20fcedcb authored by olivier R-D's avatar olivier R-D

__ne__ is necessry for python2

parent 10ca3263
...@@ -33,6 +33,9 @@ class Node(object): ...@@ -33,6 +33,9 @@ class Node(object):
return True return True
return False return False
def __ne__(self, other):
return not self.__eq__(other)
def __str__(self): def __str__(self):
return "Node({})".format(self.nodeid) return "Node({})".format(self.nodeid)
__repr__ = __str__ __repr__ = __str__
......
...@@ -334,6 +334,12 @@ class StatusCode(FrozenClass): ...@@ -334,6 +334,12 @@ class StatusCode(FrozenClass):
return 'StatusCode({})'.format(self.name) return 'StatusCode({})'.format(self.name)
__repr__ = __str__ __repr__ = __str__
def __eq__(self, other):
return self.value == other.value
def __ne__(self, other):
return not self.__eq__(other)
class NodeIdType(Enum): class NodeIdType(Enum):
TwoByte = 0 TwoByte = 0
...@@ -397,6 +403,9 @@ class NodeId(FrozenClass): ...@@ -397,6 +403,9 @@ class NodeId(FrozenClass):
def __eq__(self, node): def __eq__(self, node):
return isinstance(node, NodeId) and self.__key() == node.__key() return isinstance(node, NodeId) and self.__key() == node.__key()
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self): def __hash__(self):
return hash(self.__key()) return hash(self.__key())
...@@ -608,6 +617,9 @@ class QualifiedName(FrozenClass): ...@@ -608,6 +617,9 @@ class QualifiedName(FrozenClass):
def __eq__(self, bname): def __eq__(self, bname):
return isinstance(bname, QualifiedName) and self.Name == bname.Name and self.NamespaceIndex == bname.NamespaceIndex return isinstance(bname, QualifiedName) and self.Name == bname.Name and self.NamespaceIndex == bname.NamespaceIndex
def __ne__(self, other):
return not self.__eq__(other)
def __str__(self): def __str__(self):
return 'QualifiedName({}:{})'.format(self.NamespaceIndex, self.Name) return 'QualifiedName({}:{})'.format(self.NamespaceIndex, self.Name)
...@@ -668,6 +680,9 @@ class LocalizedText(FrozenClass): ...@@ -668,6 +680,9 @@ class LocalizedText(FrozenClass):
return True return True
return False return False
def __ne__(self, other):
return not self.__eq__(other)
class ExtensionObject(FrozenClass): class ExtensionObject(FrozenClass):
...@@ -835,6 +850,9 @@ class Variant(FrozenClass): ...@@ -835,6 +850,9 @@ class Variant(FrozenClass):
return True return True
return False return False
def __ne__(self, other):
return not self.__eq__(other)
def _guess_type(self, val): def _guess_type(self, val):
while isinstance(val, (list, tuple)): while isinstance(val, (list, tuple)):
if len(val) == 0: if len(val) == 0:
......
...@@ -23,5 +23,9 @@ if CRYPTOGRAPHY_AVAILABLE: ...@@ -23,5 +23,9 @@ if CRYPTOGRAPHY_AVAILABLE:
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig(level=logging.WARNING) logging.basicConfig(level=logging.WARNING)
#l = logging.getLogger("opcua.server.internal_subscription")
#l.setLevel(logging.DEBUG)
#l = logging.getLogger("opcua.server.internal_server")
#l.setLevel(logging.DEBUG)
unittest.main(verbosity=3) unittest.main(verbosity=3)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment