本文整理匯總了Python中pygments.token.Number.Bin方法的典型用法代碼示例。如果您正苦於以下問題:Python Number.Bin方法的具體用法?Python Number.Bin怎麽用?Python Number.Bin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pygments.token.Number
的用法示例。
在下文中一共展示了Number.Bin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_numeric_literals
# 需要導入模塊: from pygments.token import Number [as 別名]
# 或者: from pygments.token.Number import Bin [as 別名]
def test_numeric_literals(lexer):
fragment = '0 5L 9__542_72l 0xbEEf 0X9_A 0_35 01 0b0___101_0'
fragment += ' 0. .7_17F 3e-1_3d 1f 6_01.9e+3 0x.1Fp3 0XEP8D\n'
tokens = [
(Number.Integer, '0'),
(Text, ' '),
(Number.Integer, '5L'),
(Text, ' '),
(Number.Integer, '9__542_72l'),
(Text, ' '),
(Number.Hex, '0xbEEf'),
(Text, ' '),
(Number.Hex, '0X9_A'),
(Text, ' '),
(Number.Oct, '0_35'),
(Text, ' '),
(Number.Oct, '01'),
(Text, ' '),
(Number.Bin, '0b0___101_0'),
(Text, ' '),
(Number.Float, '0.'),
(Text, ' '),
(Number.Float, '.7_17F'),
(Text, ' '),
(Number.Float, '3e-1_3d'),
(Text, ' '),
(Number.Float, '1f'),
(Text, ' '),
(Number.Float, '6_01.9e+3'),
(Text, ' '),
(Number.Float, '0x.1Fp3'),
(Text, ' '),
(Number.Float, '0XEP8D'),
(Text, '\n')
]
assert list(lexer.get_tokens(fragment)) == tokens