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-10-31 15:23:24 +03:00
parent 0755624be3
commit b29b6e7d07
4 changed files with 12 additions and 21 deletions

View File

@@ -1,9 +1,7 @@
"""Программный интерфейс"""
from .core import parser as parser
from .core import Root
from pathlib import Path
from .core import Root, parser
def parse_to_src(path: str, src: str):
"""Парсит шаблон 1С-файла и сохраняет структуру файлов в папку"""

View File

@@ -1,7 +0,0 @@
from setuptools import setup, find_packages
setup(
name="onec_codetemplate_parser",
version="0.1.0",
packages=find_packages(),
)

View File

@@ -1,10 +1,12 @@
import pytest
"""fixtures for tests"""
from pathlib import Path
import pytest
TEST_FILE = 'Documents/1C/1c-text-tempates/Надулич.st'
TEST_FILE = 'Documents/1C/1c-code-templates/Надулич.st'
@pytest.fixture(scope="class")
def test_file_path():
@pytest.fixture(scope="class", name="test_file_path")
def test_data_path():
return Path.home() / TEST_FILE
@pytest.fixture(scope="class")

View File

@@ -1,7 +1,7 @@
from onec_codetemplate_parser import core
from tests.common import check_files_sequential
class Test_Read_Skobkofile:
class TestReadSkobkofile:
def test_00_test_file_exist(self, test_file_path):
assert test_file_path.exists()
@@ -21,7 +21,7 @@ class Test_Read_Skobkofile:
assert new_data == test_data
class Test_Write_To_Files:
class TestWriteToFiles:
def test_00_to_file(self, test_data, temp_src):
root = core.parser(test_data)
@@ -35,11 +35,9 @@ class Test_Write_To_Files:
# Проверка: есть ли папки
dirs = [p for p in temp_src.iterdir() if p.is_dir()]
assert len(dirs) == 1
assert (temp_src / "001.0_Надулич") in dirs
assert temp_src / "001.0_Надулич" in dirs
def test_02_sequential_name(self, temp_src):
d = temp_src / "001.0_Надулич" / "002.0_Комментарии"
subfiles = [p.name for p in d.iterdir()]
check_files_sequential(subfiles)