def testAssertTotallyOrdered(self):
    # Valid.
    self.assertTotallyOrdered()
    self.assertTotallyOrdered([1])
    self.assertTotallyOrdered([1], [2])
    self.assertTotallyOrdered([1, 1, 1])
    self.assertTotallyOrdered([(1, 1)], [(1, 2)], [(2, 1)])
    if PY_VERSION_2:
      # In Python 3 comparing different types of elements is not supported.
      self.assertTotallyOrdered([None], [1], [2])
      self.assertTotallyOrdered([1, 1, 1], ['a string'])

    # From the docstring.
    class A(object):
      def __init__(self, x, y):
        self.x = x
        self.y = y

      def __hash__(self):
        return hash(self.x)

      def __repr__(self):
        return 'A(%r, %r)' % (self.x, self.y)

      def __eq__(self, other):
        try:
          return self.x == other.x
        except AttributeError:
          return NotImplemented

      def __ne__(self, other):
        try:
          return self.x != other.x
        except AttributeError:
          return NotImplemented

      def __lt__(self, other):
        try:
          return self.x < other.x
        except AttributeError:
          return NotImplemented

      def __le__(self, other):
        try:
          return self.x <= other.x
        except AttributeError:
          return NotImplemented

      def __gt__(self, other):
        try:
          return self.x > other.x
        except AttributeError:
          return NotImplemented

      def __ge__(self, other):
        try:
          return self.x >= other.x
        except __HOLE__:
          return NotImplemented

    if PY_VERSION_2:
      self.assertTotallyOrdered(
          [None],  # None should come before everything else.
          [1],     # Integers sort earlier.
          [A(1, 'a')],
          [A(2, 'b')],  # 2 is after 1.
          [A(3, 'c'), A(3, 'd')],  # The second argument is irrelevant.
          [A(4, 'z')],
          ['foo'])  # Strings sort last.
    else:
      # Python 3 does not define ordering across different types.
      self.assertTotallyOrdered(
          [A(1, 'a')],
          [A(2, 'b')],  # 2 is after 1.
          [A(3, 'c'), A(3, 'd')],  # The second argument is irrelevant.
          [A(4, 'z')])

    # Invalid.
    self.assertRaises(AssertionError, self.assertTotallyOrdered, [2], [1])
    self.assertRaises(AssertionError, self.assertTotallyOrdered, [2], [1], [3])
    self.assertRaises(AssertionError, self.assertTotallyOrdered, [1, 2])
dataset/ETHPy150Open google/google-apputils/tests/basetest_test.py/GoogleTestBaseUnitTest.testAssertTotallyOrdered