コード例 #1
0
 def test_charrefRepr(self):
     """
     L{CharRef.__repr__} returns a value which makes it easy to see what
     character is referred to.
     """
     snowman = ord(u"\N{SNOWMAN}")
     self.assertEqual(repr(CharRef(snowman)), "CharRef(9731)")
コード例 #2
0
 def test_serializeCharRef(self):
     """
     A character reference is flattened to a string using the I{&#NNNN;}
     syntax.
     """
     ref = CharRef(ord("\N{SNOWMAN}"))
     return self.assertFlattensTo(ref, b"☃")
コード例 #3
0
 def test_serializeCharRef(self) -> None:
     """
     A character reference is flattened to a string using the I{&#NNNN;}
     syntax.
     """
     ref = CharRef(ord("\N{SNOWMAN}"))
     self.assertFlattensImmediately(ref, b"☃")