def test_serialization_respects_type_inheritance(self):
     """Test that the serialization type of an object is inferred by
     inheritance, like the behavior of the ``isinstance`` built-in
     function, not by checking strict type equality."""
     TupleLike = namedtuple("TupleLike", ["spam", "ham", "eggs"])
     tuple_like = TupleLike(spam=1, ham=2, eggs=3)
     computed = typedbytes.dumps(tuple_like)
     expected = typedbytes.dumps(tuple(tuple_like))
     # tuple_like is an instance of tuple, so we expect it to be
     # serialized exactly like a "normal" tuple.
     self.assertEqual(expected, computed)
 def test_NaN_round_trip(self):
     obj = float('nan')
     self.assertTrue(isnan(typedbytes.loads(typedbytes.dumps(obj))))