Index: trunk/contrib/python/ldns_rdf.i
===================================================================
--- trunk/contrib/python/ldns_rdf.i	(Revision 3721)
+++ trunk/contrib/python/ldns_rdf.i	(Arbeitskopie)
@@ -299,18 +299,86 @@
 
         def __cmp__(self, other):
             """
-               Compares two rdf's on their wire formats.
+               Compares two rdfs on their wire formats.
                
                (To order dnames according to rfc4034, use ldns_dname_compare.)
                
                :param other: The second one RDF.
                :type other: :class:`ldns_rdf`
-               :throws TypeError: When other of non-:class:`ldns_rdf` type.
+               :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
                :return: (int) -1, 0 or 1 if self comes before other,
                    is equal or self comes after other respectively.
             """
             return _ldns.ldns_rdf_compare(self, other)
-            
+
+        def __lt__(self, other):
+            """
+                Compares two rdfs on their formats.
+
+                :param other: The socond one RDF.
+                :type other: :class:`ldns_rdf`
+                :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+                :return: (bool) True when `self` is less than 'other'.
+            """
+            return _ldns.ldns_rdf_compare(self, other) == -1
+
+        def __le__(self, other):
+            """
+                Compares two rdfs on their formats.
+
+                :param other: The socond one RDF.
+                :type other: :class:`ldns_rdf`
+                :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+                :return: (bool) True when `self` is less than or equal to
+                    'other'.
+            """
+            return _ldns.ldns_rdf_compare(self, other) != 1
+
+        def __eq__(self, other):
+            """
+                Compares two rdfs on their formats.
+
+                :param other: The socond one RDF.
+                :type other: :class:`ldns_rdf`
+                :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+                :return: (bool) True when `self` is equal to 'other'.
+            """
+            return _ldns.ldns_rdf_compare(self, other) == 0
+
+        def __ne__(self, other):
+            """
+                Compares two rdfs on their formats.
+
+                :param other: The socond one RDF.
+                :type other: :class:`ldns_rdf`
+                :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+                :return: (bool) True when `self` is not equal to 'other'.
+            """
+            return _ldns.ldns_rdf_compare(self, other) != 0
+
+        def __gt__(self, other):
+            """
+                Compares two rdfs on their formats.
+
+                :param other: The socond one RDF.
+                :type other: :class:`ldns_rdf`
+                :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+                :return: (bool) True when `self` is greater than 'other'.
+            """
+            return _ldns.ldns_rdf_compare(self, other) == 1
+
+        def __ge__(self, other):
+            """
+                Compares two rdfs on their formats.
+
+                :param other: The socond one RDF.
+                :type other: :class:`ldns_rdf`
+                :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+                :return: (bool) True when `self` is greater than or equal to
+                    'other'.
+            """
+            return _ldns.ldns_rdf_compare(self, other) != -1
+
         def print_to_file(self, output):
             """
                Prints the data in the rdata field to the given `output` file
@@ -527,15 +595,15 @@
 
         def dname_compare(self, other):
             """
-               Compares the two dname rdf's according to the algorithm
+               Compares two dname rdf according to the algorithm
                for ordering in RFC4034 Section 6.
 
                :param other: The second dname rdf to compare.
                :type other: :class:`ldns_rdf`
                :throws TypeError: When not a :class:`ldns_rdf` used.
                :throws Exception: When not dnames compared.
-               :return: (int) -1, 0 or 1 if self comes before other,
-                   self is equal or self comes after other respectively.
+               :return: (int) -1, 0 or 1 if `self` comes before `other`,
+                   `self` is equal or `self` comes after `other` respectively.
 
                .. warning::
 
Index: trunk/contrib/python/Changelog
===================================================================
--- trunk/contrib/python/Changelog	(Revision 3721)
+++ trunk/contrib/python/Changelog	(Arbeitskopie)
@@ -1,4 +1,6 @@
 1.6.14
+	* Added rich comparison methods for ldns_dname, ldns_rdf, ldns_rr and
+	  ldns_rr_list classes.
 	* Added deprecation warnings into ldns_rr.new_frm_fp() and
 	  ldns_rr.new_frm_fp_l() and others.
 	* Fixed ldns_rr.set_rdf(), which may cause memory leaks, because it
Index: trunk/contrib/python/ldns_rr.i
===================================================================
--- trunk/contrib/python/ldns_rr.i	(Revision 3721)
+++ trunk/contrib/python/ldns_rr.i	(Arbeitskopie)
@@ -796,7 +796,6 @@
         # _LDNS_RR_CONSTRUCTORS
         #
 
-
         def __str__(self):
             """
                Converts the data in the resource record to presentation format.
@@ -819,6 +818,86 @@
             """
             return _ldns.ldns_rr_compare(self, other)
 
+        def __lt__(self, other):
+            """
+               Compares two rrs.
+               
+               The TTL is not looked at.
+               
+               :param other: The second RR one.
+               :type other: :class:`ldns_rr`
+               :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+               :return: (bool) True when `self` is less than 'other'.
+            """
+            return _ldns.ldns_rr_compare(self, other) == -1
+
+        def __le__(self, other):
+            """
+               Compares two rrs.
+               
+               The TTL is not looked at.
+               
+               :param other: The second RR one.
+               :type other: :class:`ldns_rr`
+               :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+               :return: (bool) True when `self` is less than or equal to
+                   'other'.
+            """
+            return _ldns.ldns_rr_compare(self, other) != 1
+
+        def __eq__(self, other):
+            """
+               Compares two rrs.
+               
+               The TTL is not looked at.
+               
+               :param other: The second RR one.
+               :type other: :class:`ldns_rr`
+               :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+               :return: (bool) True when `self` is equal to 'other'.
+            """
+            return _ldns.ldns_rr_compare(self, other) == 0
+
+        def __ne__(self, other):
+            """
+               Compares two rrs.
+               
+               The TTL is not looked at.
+               
+               :param other: The second RR one.
+               :type other: :class:`ldns_rr`
+               :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+               :return: (bool) True when `self` is not equal to 'other'.
+            """
+            return _ldns.ldns_rr_compare(self, other) != 0
+
+        def __gt__(self, other):
+            """
+               Compares two rrs.
+               
+               The TTL is not looked at.
+               
+               :param other: The second RR one.
+               :type other: :class:`ldns_rr`
+               :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+               :return: (bool) True when `self` is greater than 'other'.
+            """
+            return _ldns.ldns_rr_compare(self, other) == 1
+
+        def __ge__(self, other):
+            """
+               Compares two rrs.
+               
+               The TTL is not looked at.
+               
+               :param other: The second RR one.
+               :type other: :class:`ldns_rr`
+               :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+               :return: (bool) True when `self` is greater than or equal to
+                    'other'.
+            """
+            return _ldns.ldns_rr_compare(self, other) != -1
+
         @staticmethod
         def class_by_name(string):
             """
@@ -1923,6 +2002,80 @@
             """
             return _ldns.ldns_rr_list_compare(self, rrl2)
 
+        def __lt__(self, other):
+            """
+               Compares two rr lists.
+               
+               :param other: The second one.
+               :type other: :class:`ldns_rr_list`
+               :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+                   type.
+               :return: (bool) True when `self` is less than 'other'.
+            """
+            return _ldns.ldns_rr_list_compare(self, other) == -1
+
+        def __le__(self, other):
+            """
+               Compares two rr lists.
+               
+               :param other: The second one.
+               :type other: :class:`ldns_rr_list`
+               :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+                   type.
+               :return: (bool) True when `self` is less than or equal to
+                   'other'.
+            """
+            return _ldns.ldns_rr_list_compare(self, other) != 1
+
+        def __eq__(self, other):
+            """
+               Compares two rr lists.
+               
+               :param other: The second one.
+               :type other: :class:`ldns_rr_list`
+               :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+                   type.
+               :return: (bool) True when `self` is equal to 'other'.
+            """
+            return _ldns.ldns_rr_list_compare(self, other) == 0
+
+        def __ne__(self, other):
+            """
+               Compares two rr lists.
+               
+               :param other: The second one.
+               :type other: :class:`ldns_rr_list`
+               :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+                   type.
+               :return: (bool) True when `self` is not equal to 'other'.
+            """
+            return _ldns.ldns_rr_list_compare(self, other) != 0
+
+        def __gt__(self, other):
+            """
+               Compares two rr lists.
+               
+               :param other: The second one.
+               :type other: :class:`ldns_rr_list`
+               :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+                   type.
+               :return: (bool) True when `self` is greater than 'other'.
+            """
+            return _ldns.ldns_rr_list_compare(self, other) == 1
+
+        def __ge__(self, other):
+            """
+               Compares two rr lists.
+               
+               :param other: The second one.
+               :type other: :class:`ldns_rr_list`
+               :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+                   type.
+               :return: (bool) True when `self` is greater than or equal to
+                   'other'.
+            """
+            return _ldns.ldns_rr_list_compare(self, other) != -1
+
         def write_to_buffer(self, buffer):
             """
                Copies the rr_list data to the buffer in wire format.
Index: trunk/contrib/python/ldns_dname.i
===================================================================
--- trunk/contrib/python/ldns_dname.i	(Revision 3721)
+++ trunk/contrib/python/ldns_dname.i	(Arbeitskopie)
@@ -202,7 +202,7 @@
 
         def __cmp__(self, other):
             """
-               Compares the two dname rdf's according to the algorithm for
+               Compares two dname rdf according to the algorithm for
                ordering in RFC4034 Section 6.
                
                :param other: The second dname rdf to compare.
@@ -234,6 +234,206 @@
                 raise Exception("Operands must be ldns_dname.")
             return _ldns.ldns_dname_compare(self, other)
 
+        def __lt__(self, other):
+            """
+               Compares two dname rdf according to the algorithm for
+               ordering in RFC4034 Section 6.
+               
+               :param other: The second dname rdf to compare.
+               :type other: :class:`ldns_dname`
+               :throws TypeError: When `other` of invalid type.
+               :return: (bool) True when `self` is less than 'other'.
+
+               .. note::
+                   The type checking of parameter `other` is benevolent.
+                   It allows also to pass a dname :class:`ldns_rdf` object.
+                   This will probably change in future.                   
+            """
+            #
+            # The wrapped function generates asserts instead of setting
+            # error status. They cannot be caught from Python so a check
+            # is necessary. 
+            #
+            if (not isinstance(other, ldns_dname)) and \
+               isinstance(other, ldns_rdf) and \
+               other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+                warnings.warn("The ldns_dname.__lt__() method will" +
+                    " drop the possibility to compare ldns_rdf." +
+                    " Convert arguments to ldns_dname.",
+                    PendingDeprecationWarning, stacklevel=2)
+            if not isinstance(other, ldns_rdf):
+                raise TypeError("Parameter must be derived from ldns_rdf.")
+            if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+                raise Exception("Operands must be ldns_dname.")
+            return _ldns.ldns_dname_compare(self, other) == -1
+
+        def __le__(self, other):
+            """
+               Compares two dname rdf according to the algorithm for
+               ordering in RFC4034 Section 6.
+               
+               :param other: The second dname rdf to compare.
+               :type other: :class:`ldns_dname`
+               :throws TypeError: When `other` of invalid type.
+               :return: (bool) True when `self` is less than or equal to
+                   'other'.
+
+               .. note::
+                   The type checking of parameter `other` is benevolent.
+                   It allows also to pass a dname :class:`ldns_rdf` object.
+                   This will probably change in future.                   
+            """
+            #
+            # The wrapped function generates asserts instead of setting
+            # error status. They cannot be caught from Python so a check
+            # is necessary. 
+            #
+            if (not isinstance(other, ldns_dname)) and \
+               isinstance(other, ldns_rdf) and \
+               other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+                warnings.warn("The ldns_dname.__le__() method will" +
+                    " drop the possibility to compare ldns_rdf." +
+                    " Convert arguments to ldns_dname.",
+                    PendingDeprecationWarning, stacklevel=2)
+            if not isinstance(other, ldns_rdf):
+                raise TypeError("Parameter must be derived from ldns_rdf.")
+            if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+                raise Exception("Operands must be ldns_dname.")
+            return _ldns.ldns_dname_compare(self, other) != 1
+
+        def __eq__(self, other):
+            """
+               Compares two dname rdf according to the algorithm for
+               ordering in RFC4034 Section 6.
+               
+               :param other: The second dname rdf to compare.
+               :type other: :class:`ldns_dname`
+               :throws TypeError: When `other` of invalid type.
+               :return: (bool) True when `self` is equal to 'other'.
+
+               .. note::
+                   The type checking of parameter `other` is benevolent.
+                   It allows also to pass a dname :class:`ldns_rdf` object.
+                   This will probably change in future.                   
+            """
+            #
+            # The wrapped function generates asserts instead of setting
+            # error status. They cannot be caught from Python so a check
+            # is necessary. 
+            #
+            if (not isinstance(other, ldns_dname)) and \
+               isinstance(other, ldns_rdf) and \
+               other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+                warnings.warn("The ldns_dname.__eq__() method will" +
+                    " drop the possibility to compare ldns_rdf." +
+                    " Convert arguments to ldns_dname.",
+                    PendingDeprecationWarning, stacklevel=2)
+            if not isinstance(other, ldns_rdf):
+                raise TypeError("Parameter must be derived from ldns_rdf.")
+            if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+                raise Exception("Operands must be ldns_dname.")
+            return _ldns.ldns_dname_compare(self, other) == 0
+
+        def __ne__(self, other):
+            """
+               Compares two dname rdf according to the algorithm for
+               ordering in RFC4034 Section 6.
+               
+               :param other: The second dname rdf to compare.
+               :type other: :class:`ldns_dname`
+               :throws TypeError: When `other` of invalid type.
+               :return: (bool) True when `self` is not equal to 'other'.
+
+               .. note::
+                   The type checking of parameter `other` is benevolent.
+                   It allows also to pass a dname :class:`ldns_rdf` object.
+                   This will probably change in future.                   
+            """
+            #
+            # The wrapped function generates asserts instead of setting
+            # error status. They cannot be caught from Python so a check
+            # is necessary. 
+            #
+            if (not isinstance(other, ldns_dname)) and \
+               isinstance(other, ldns_rdf) and \
+               other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+                warnings.warn("The ldns_dname.__ne__() method will" +
+                    " drop the possibility to compare ldns_rdf." +
+                    " Convert arguments to ldns_dname.",
+                    PendingDeprecationWarning, stacklevel=2)
+            if not isinstance(other, ldns_rdf):
+                raise TypeError("Parameter must be derived from ldns_rdf.")
+            if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+                raise Exception("Operands must be ldns_dname.")
+            return _ldns.ldns_dname_compare(self, other) != 0
+
+        def __gt__(self, other):
+            """
+               Compares two dname rdf according to the algorithm for
+               ordering in RFC4034 Section 6.
+               
+               :param other: The second dname rdf to compare.
+               :type other: :class:`ldns_dname`
+               :throws TypeError: When `other` of invalid type.
+               :return: (bool) True when `self` is greater than 'other'.
+
+               .. note::
+                   The type checking of parameter `other` is benevolent.
+                   It allows also to pass a dname :class:`ldns_rdf` object.
+                   This will probably change in future.                   
+            """
+            #
+            # The wrapped function generates asserts instead of setting
+            # error status. They cannot be caught from Python so a check
+            # is necessary. 
+            #
+            if (not isinstance(other, ldns_dname)) and \
+               isinstance(other, ldns_rdf) and \
+               other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+                warnings.warn("The ldns_dname.__gt__() method will" +
+                    " drop the possibility to compare ldns_rdf." +
+                    " Convert arguments to ldns_dname.",
+                    PendingDeprecationWarning, stacklevel=2)
+            if not isinstance(other, ldns_rdf):
+                raise TypeError("Parameter must be derived from ldns_rdf.")
+            if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+                raise Exception("Operands must be ldns_dname.")
+            return _ldns.ldns_dname_compare(self, other) == 1
+
+        def __ge__(self, other):
+            """
+               Compares two dname rdf according to the algorithm for
+               ordering in RFC4034 Section 6.
+               
+               :param other: The second dname rdf to compare.
+               :type other: :class:`ldns_dname`
+               :throws TypeError: When `other` of invalid type.
+               :return: (bool) True when `self` is greater than or equal to
+                   'other'.
+
+               .. note::
+                   The type checking of parameter `other` is benevolent.
+                   It allows also to pass a dname :class:`ldns_rdf` object.
+                   This will probably change in future.                   
+            """
+            #
+            # The wrapped function generates asserts instead of setting
+            # error status. They cannot be caught from Python so a check
+            # is necessary. 
+            #
+            if (not isinstance(other, ldns_dname)) and \
+               isinstance(other, ldns_rdf) and \
+               other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+                warnings.warn("The ldns_dname.__ge__() method will" +
+                    " drop the possibility to compare ldns_rdf." +
+                    " Convert arguments to ldns_dname.",
+                    PendingDeprecationWarning, stacklevel=2)
+            if not isinstance(other, ldns_rdf):
+                raise TypeError("Parameter must be derived from ldns_rdf.")
+            if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+                raise Exception("Operands must be ldns_dname.")
+            return _ldns.ldns_dname_compare(self, other) != -1
+
         def cat(self, rd2):
             """
                Concatenates rd2 after this dname (`rd2` is copied,
Index: trunk/contrib/python/examples/test_rdf.py
===================================================================
--- trunk/contrib/python/examples/test_rdf.py	(Revision 3721)
+++ trunk/contrib/python/examples/test_rdf.py	(Arbeitskopie)
@@ -45,6 +45,109 @@
 
 #if not error_detected:
 if True:
+    method_name = class_name + ".[comparison operators]"
+    rdf1 = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)
+    rdf2 = ldns.ldns_rdf.new_frm_str("1.1.1.1", ldns.LDNS_RDF_TYPE_A)
+    try:
+        ret = rdf1 < rdf2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf2 < rdf1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf1 <= rdf2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf2 <= rdf1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf1 == rdf2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf1 == rdf1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf1 != rdf2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf1 != rdf1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf1 > rdf2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf2 > rdf1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf1 >= rdf2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rdf2 >= rdf1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+
+
+#if not error_detected:
+if True:
     method_name = "ldns_rdf_new()"
     sys.stderr.write("%s not tested.\n" % (method_name))
 
Index: trunk/contrib/python/examples/test_rr.py
===================================================================
--- trunk/contrib/python/examples/test_rr.py	(Revision 3721)
+++ trunk/contrib/python/examples/test_rr.py	(Arbeitskopie)
@@ -32,36 +32,108 @@
        (inspect.currentframe().f_back.f_lineno, method_name))
 
 
+
 #if not error_detected:
-#if True:
-#    method_name = class_name + ".__cmp__()"
-#    rr1 = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")
-#    rr2 = ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1")
-#    try:
-#        ret = rr1 < rr2
-#        if ret != True:
-#            set_error()
-#    except:
-#        set_error()
-#    try:
-#        ret = rr1 == rr2
-#        if ret != False:
-#            set_error()
-#    except:
-#        set_error()
-#    try:
-#        ret = rr1 > rr2
-#        if ret != False:
-#            set_error()
-#    except:
-#        set_error()
-#    try:
-#        ret = rr1 != ""
-#        set_error()
-#    except TypeError:
-#        pass
-#    except:
-#        set_error()
+if True:
+    method_name = class_name + ".[comparison operators]"
+    rr1 = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")
+    rr2 = ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1")
+    try:
+        ret = rr1 < rr2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr2 < rr1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr1 <= rr2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr2 <= rr1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr1 == rr2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr1 == rr1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr1 != rr2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr1 != rr1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr1 > rr2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr2 > rr1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr1 >= rr2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rr2 >= rr1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
 
 
 #if not error_detected:
@@ -1684,37 +1756,108 @@
 
 
 #if not error_detected:
-#if True:
-#    method_name = class_name + ".__cmp__()"
-#    rrl1 = ldns.ldns_rr_list.new()
-#    rrl1.push_rr(ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0"))
-#    rrl2 = ldns.ldns_rr_list.new()
-#    rrl2.push_rr(ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1"))
-#    try:
-#        ret = rrl1 < rrl2
-#        if ret != True:
-#            set_error()
-#    except:
-#        set_error()
-#    try:
-#        ret = rrl1 == rrl2
-#        if ret != False:
-#            set_error()
-#    except:
-#        set_error()
-#    try:
-#        ret = rrl1 > rrl2
-#        if ret != False:
-#            set_error()
-#    except:
-#        set_error()
-#    try:
-#        ret = rrl1 != ""
-#        set_error()
-#    except TypeError:
-#        pass
-#    except:
-#        set_error()
+if True:
+    method_name = class_name + ".[comparison operators]"
+    rrl1 = ldns.ldns_rr_list.new()
+    rrl1.push_rr(ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0"))
+    rrl2 = ldns.ldns_rr_list.new()
+    rrl2.push_rr(ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1"))
+    try:
+        ret = rrl1 < rrl2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl2 < rrl1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl1 <= rrl2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl2 <= rrl1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl1 == rrl2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl1 == rrl1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl1 != rrl2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl1 != rrl1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl1 > rrl2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl2 > rrl1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl1 >= rrl2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = rrl2 >= rrl1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
 
 
 #if not error_detected:
Index: trunk/contrib/python/examples/test_dname.py
===================================================================
--- trunk/contrib/python/examples/test_dname.py	(Revision 3721)
+++ trunk/contrib/python/examples/test_dname.py	(Arbeitskopie)
@@ -81,6 +81,109 @@
 
 #if not error_detected:
 if True:
+    method_name = class_name + ".[comparison operators]"
+    dn1 = ldns.ldns_dname("a.test")
+    dn2 = ldns.ldns_dname("b.test")
+    try:
+        ret = dn1 < dn2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn2 < dn1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn1 <= dn2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn2 <= dn1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn1 == dn2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn1 == dn1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn1 != dn2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn1 != dn1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn1 > dn2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn2 > dn1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn1 >= dn2
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != False:
+            set_error()
+    except:
+        set_error()
+    try:
+        ret = dn2 >= dn1
+        if not isinstance(ret, bool):
+            set_error()
+        if ret != True:
+            set_error()
+    except:
+        set_error()
+
+
+#if not error_detected:
+if True:
     method_name = class_name + ".absolute()"
     dname = ldns.ldns_dname("www.nic.cz.")
     try:
