1
0
mirror of https://github.com/240596448/onec_codetemplate_parser.git synced 2025-11-23 21:34:39 +02:00
This commit is contained in:
Vladimir Nadulich
2025-11-01 01:56:12 +03:00
parent 7fc87e766c
commit b0b6983ab9
3 changed files with 22 additions and 4 deletions

View File

@@ -159,7 +159,7 @@ class Root(Node):
for child in self.children:
parts.append(",\n")
parts.append(child.compile())
parts.append("\n}")
parts.append("\n}" if self.children else "}")
return "".join(parts)
def to_files(self, path):

View File

@@ -2,12 +2,28 @@
from pathlib import Path
import pytest
import os
TEST_FILE = 'Documents/1C/1c-code-templates/Надулич.st'
@pytest.fixture(scope="class", name="test_file_path")
def test_data_path():
return Path.home() / TEST_FILE
def get_all_test_files():
"""Автоматически находим все файлы в директории"""
st_files = Path(__file__).parent.glob("data/*.st")
list_st_files = [f for f in st_files if f.is_file()]
list_st_files.append(Path.home()/TEST_FILE)
env_st_templates = os.getenv("ST_TEMPLATES")
if env_st_templates:
st_templates = Path(env_st_templates)
if st_templates.is_file():
list_st_files.append(st_templates)
return [pytest.param(e, id=e.name) for e in list_st_files]
@pytest.fixture(scope="class", name="test_file_path", params=get_all_test_files())
def test_data_path(request):
return Path(request.param)
@pytest.fixture(scope="class")
def test_data(test_file_path):

2
tests/pytest.ini Normal file
View File

@@ -0,0 +1,2 @@
[pytest]
disable_test_id_escaping_and_forfeit_all_rights_to_community_support = True