本文整理汇总了Python中ListOps.src.parser.Parser._read_list_of_numbers方法的典型用法代码示例。如果您正苦于以下问题:Python Parser._read_list_of_numbers方法的具体用法?Python Parser._read_list_of_numbers怎么用?Python Parser._read_list_of_numbers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListOps.src.parser.Parser
的用法示例。
在下文中一共展示了Parser._read_list_of_numbers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_read_list_of_one_number
# 需要导入模块: from ListOps.src.parser import Parser [as 别名]
# 或者: from ListOps.src.parser.Parser import _read_list_of_numbers [as 别名]
def test_read_list_of_one_number(self):
value = "{12}"
scanner = Scanner(value)
parser = Parser(scanner)
parser._advance()
list = parser._read_list_of_numbers()
ref_list = List([Number(12)])
self.assertEqual(list, ref_list)
示例2: test_read_list_of_numbers
# 需要导入模块: from ListOps.src.parser import Parser [as 别名]
# 或者: from ListOps.src.parser.Parser import _read_list_of_numbers [as 别名]
def test_read_list_of_numbers(self):
value = "{12,-3,12.42,-31.21,+41}"
scanner = Scanner(value)
parser = Parser(scanner)
parser._advance()
list = parser._read_list_of_numbers()
ref_list = List([Number(12), Number(-3), Number(12.42), Number(-31.21), Number(41)])
self.assertEqual(list, ref_list)
示例3: test_fail_to_read_list_of_numbers_with_wrong_element
# 需要导入模块: from ListOps.src.parser import Parser [as 别名]
# 或者: from ListOps.src.parser.Parser import _read_list_of_numbers [as 别名]
def test_fail_to_read_list_of_numbers_with_wrong_element(self):
value = "{12,-3,a,-31.21,}"
scanner = Scanner(value)
parser = Parser(scanner)
parser._advance()
self.assertRaises(UnexpectedToken, lambda: parser._read_list_of_numbers())
示例4: test_fail_to_read_list_of_numbers_ending_with_comma
# 需要导入模块: from ListOps.src.parser import Parser [as 别名]
# 或者: from ListOps.src.parser.Parser import _read_list_of_numbers [as 别名]
def test_fail_to_read_list_of_numbers_ending_with_comma(self):
value = "{12,-3,12.42,-31.21,}"
scanner = Scanner(value)
parser = Parser(scanner)
parser._advance()
self.assertRaises(UnexpectedToken, lambda: parser._read_list_of_numbers())