本文整理汇总了Python中Quasar.parser.tokens.css_tokens.CSSTokenizer.consume_numeric_token方法的典型用法代码示例。如果您正苦于以下问题:Python CSSTokenizer.consume_numeric_token方法的具体用法?Python CSSTokenizer.consume_numeric_token怎么用?Python CSSTokenizer.consume_numeric_token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quasar.parser.tokens.css_tokens.CSSTokenizer
的用法示例。
在下文中一共展示了CSSTokenizer.consume_numeric_token方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_consume_numeric_token_number1
# 需要导入模块: from Quasar.parser.tokens.css_tokens import CSSTokenizer [as 别名]
# 或者: from Quasar.parser.tokens.css_tokens.CSSTokenizer import consume_numeric_token [as 别名]
def test_consume_numeric_token_number1():
token_stream = CSSTokenizer("12345")
token_stream.consume_numeric_token()
assert not token_stream.stream
assert isinstance(token_stream.tokens[0], NumberToken)
assert token_stream.tokens[0].type_ == 'integer'
assert token_stream.tokens[0].value == 12345
assert token_stream.tokens[0].string == '12345'
示例2: test_consume_numeric_token_percentage1
# 需要导入模块: from Quasar.parser.tokens.css_tokens import CSSTokenizer [as 别名]
# 或者: from Quasar.parser.tokens.css_tokens.CSSTokenizer import consume_numeric_token [as 别名]
def test_consume_numeric_token_percentage1():
token_stream = CSSTokenizer("12345%")
token_stream.consume_numeric_token()
assert not token_stream.stream
assert isinstance(token_stream.tokens[0], PercentageToken)
assert token_stream.tokens[0].type_ == 'number'
assert token_stream.tokens[0].value == 12345
assert token_stream.tokens[0].string == '12345'
assert str(token_stream.tokens[0]) == '12345 %'
示例3: test_consume_numeric_token_dimension1
# 需要导入模块: from Quasar.parser.tokens.css_tokens import CSSTokenizer [as 别名]
# 或者: from Quasar.parser.tokens.css_tokens.CSSTokenizer import consume_numeric_token [as 别名]
def test_consume_numeric_token_dimension1():
token_stream = CSSTokenizer("12345meters")
token_stream.consume_numeric_token()
assert not token_stream.stream
assert isinstance(token_stream.tokens[0], DimensionToken)
assert token_stream.tokens[0].type_ is 'integer'
print vars(token_stream.tokens[0])
assert token_stream.tokens[0].value == 12345
assert token_stream.tokens[0].string == '12345'
assert token_stream.tokens[0].unit == 'meters'
assert str(token_stream.tokens[0]) == '12345 meters'