本文整理汇总了Python中tap.parser.Parser.parse_line方法的典型用法代码示例。如果您正苦于以下问题:Python Parser.parse_line方法的具体用法?Python Parser.parse_line怎么用?Python Parser.parse_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tap.parser.Parser
的用法示例。
在下文中一共展示了Parser.parse_line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_finds_description
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_description(self):
parser = Parser()
line = parser.parse_line('ok 42 A passing test.')
self.assertEqual('test', line.category)
self.assertEqual('A passing test.', line.description)
示例2: test_finds_todo
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_todo(self):
parser = Parser()
line = parser.parse_line('ok A description # TODO Not done')
self.assertEqual('test', line.category)
self.assertTrue(line.todo)
示例3: test_finds_skip
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_skip(self):
parser = Parser()
line = parser.parse_line('ok A description # SKIP for now')
self.assertEqual('test', line.category)
self.assertTrue(line.skip)
示例4: test_unrecognizable_line
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_unrecognizable_line(self):
"""The parser returns an unrecognizable line."""
parser = Parser()
line = parser.parse_line('This is not a valid TAP line. # srsly')
self.assertEqual('unknown', line.category)
示例5: test_after_hash_is_not_description
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_after_hash_is_not_description(self):
parser = Parser()
line = parser.parse_line("ok A description # Not part of description.")
self.assertEqual("test", line.category)
self.assertEqual("A description", line.description)
示例6: test_ignores_plan_with_any_non_skip_directive
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_ignores_plan_with_any_non_skip_directive(self):
"""The parser only recognizes SKIP directives in plans."""
parser = Parser()
line = parser.parse_line('1..42 # TODO will not work.')
self.assertEqual('unknown', line.category)
示例7: test_finds_number
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_number(self):
"""The parser extracts a test number."""
parser = Parser()
line = parser.parse_line('ok 42 is the magic number.')
self.assertEqual('test', line.category)
self.assertEqual(42, line.number)
示例8: test_finds_plan_with_skip
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_plan_with_skip(self):
"""The parser extracts a plan line containing a SKIP."""
parser = Parser()
line = parser.parse_line('1..42 # Skipping this test file.')
self.assertEqual('plan', line.category)
self.assertTrue(line.skip)
示例9: test_finds_plan
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_plan(self):
"""The parser extracts a plan line."""
parser = Parser()
line = parser.parse_line('1..42')
self.assertEqual('plan', line.category)
self.assertEqual(42, line.expected_tests)
示例10: test_finds_version
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_version(self):
"""The parser extracts a version line."""
parser = Parser()
line = parser.parse_line('TAP version 13')
self.assertEqual('version', line.category)
self.assertEqual(13, line.version)
示例11: test_bail_out_line
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_bail_out_line(self):
"""The parser extracts a bail out line."""
parser = Parser()
line = parser.parse_line('Bail out! This is the reason to bail.')
self.assertEqual('bail', line.category)
self.assertEqual('This is the reason to bail.', line.reason)
示例12: test_diagnostic_line
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_diagnostic_line(self):
"""The parser extracts a diagnostic line."""
text = '# An example diagnostic line'
parser = Parser()
line = parser.parse_line(text)
self.assertEqual('diagnostic', line.category)
self.assertEqual(text, line.text)
示例13: test_finds_not_ok
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_not_ok(self):
"""The parser extracts a not ok line."""
parser = Parser()
line = parser.parse_line('not ok - This is a failing test line.')
self.assertEqual('test', line.category)
self.assertFalse(line.ok)
self.assertTrue(line.number is None)
示例14: test_finds_ok
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_ok(self):
"""The parser extracts an ok line."""
parser = Parser()
line = parser.parse_line("ok - This is a passing test line.")
self.assertEqual("test", line.category)
self.assertTrue(line.ok)
self.assertTrue(line.number is None)
示例15: test_finds_not_ok
# 需要导入模块: from tap.parser import Parser [as 别名]
# 或者: from tap.parser.Parser import parse_line [as 别名]
def test_finds_not_ok(self):
"""The parser extracts a not ok line."""
parser = Parser()
line = parser.parse_line("not ok - This is a failing test line.")
self.assertEqual("test", line.category)
self.assertFalse(line.ok)
self.assertTrue(line.number is None)
self.assertEqual("", line.directive.text)