':py:class:`X509NameType` instances should compare based on their NIDs.'

def test_comparison(self):

    def _equality(a, b, assertTrue, assertFalse):
        assertTrue((a == b), ('(%r    ==    %r)    -->    False' % (a, b)))
        assertFalse((a != b))
        assertTrue((b == a))
        assertFalse((b != a))
    def assertEqual(a, b):
        _equality(a, b, self.assertTrue, self.assertFalse)
    name = self._x509name()
    assertEqual(name, name)
    assertEqual(self._x509name(), self._x509name())
    assertEqual(self._x509name(commonName='foo'), self._x509name(commonName='foo'))
    assertEqual(self._x509name(commonName='foo'), self._x509name(CN='foo'))
    assertEqual(self._x509name(CN='foo', organizationalUnitName='bar'), self._x509name(commonName='foo', OU='bar'))
    def assertNotEqual(a, b):
        _equality(a, b, self.assertFalse, self.assertTrue)
    assertNotEqual(self._x509name(CN='foo'), self._x509name(CN='bar'))
    assertNotEqual(self._x509name(CN='foo'), self._x509name(OU='foo'))
    def _inequality(a, b, assertTrue, assertFalse):
        assertTrue((a < b))
        assertTrue((a <= b))
        assertTrue((b > a))
        assertTrue((b >= a))
        assertFalse((a > b))
        assertFalse((a >= b))
        assertFalse((b < a))
        assertFalse((b <= a))
    def assertLessThan(a, b):
        _inequality(a, b, self.assertTrue, self.assertFalse)
    assertLessThan(self._x509name(CN='abc'), self._x509name(CN='def'))
    def assertGreaterThan(a, b):
        _inequality(a, b, self.assertFalse, self.assertTrue)
    assertGreaterThan(self._x509name(CN='def'), self._x509name(CN='abc'))
