def test_to_string(self): for known_string, known_encoding in self.examples: obj = ObjectIdentifier(known_encoding) string = str(obj) print(known_string, binascii.hexlify(known_encoding), string) self.assertEqual(known_string, string) with self.assertRaises(AssertionError): ObjectIdentifier.from_string('3.0') with self.assertRaises(AssertionError): ObjectIdentifier.from_string('1.41')