소스 검색

Merge pull request #689 from rec/tests

Test print argument to lark.tools.standalone.main
tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.10.0
Erez Shinan 4 년 전
committed by GitHub
부모
커밋
dc30692015
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
1개의 변경된 파일4개의 추가작업 그리고 7개의 파일을 삭제
  1. +4
    -7
      tests/test_tools.py

+ 4
- 7
tests/test_tools.py 파일 보기

@@ -1,8 +1,9 @@
from __future__ import absolute_import
from __future__ import absolute_import, print_function

import sys
from unittest import TestCase, main

from functools import partial
from lark.tree import Tree
from lark.tools import standalone

@@ -20,10 +21,8 @@ class TestStandalone(TestCase):

def _create_standalone(self, grammar):
code_buf = StringIO()
temp = sys.stdout
sys.stdout = code_buf
standalone.main(StringIO(grammar), 'start')
sys.stdout = temp
pr = partial(print, file=code_buf)
standalone.main(StringIO(grammar), 'start', print=pr)
code = code_buf.getvalue()

context = {}
@@ -137,5 +136,3 @@ class TestStandalone(TestCase):

if __name__ == '__main__':
main()



불러오는 중...
취소
저장