Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pycomsdk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
com
pycomsdk
Commits
b05eec3f
Commit
b05eec3f
authored
Apr 22, 2025
by
Sergey Bobrov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправил вызов парсера
parent
2b68d2be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
74 deletions
+3
-74
unit_test_aDOT.py
tests/test_aDOT/unit_test_aDOT.py
+3
-1
test_parser.py
tests/test_parser.py
+0
-73
No files found.
tests/test_aDOT/unit_test_aDOT.py
View file @
b05eec3f
...
...
@@ -8,7 +8,9 @@ class TestADOTParser(unittest.TestCase):
@classmethod
def
setUpClass
(
cls
):
cls
.
test_files_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"test_adot_files"
)
cls
.
parser
=
Parser
()
def
setUp
(
self
):
self
.
parser
=
Parser
()
def
test_sequential_graph
(
self
):
"""Тест последовательного графа"""
...
...
tests/test_parser.py
View file @
b05eec3f
...
...
@@ -9,79 +9,6 @@ path_to_comsdk = "/home/lbstr/bmstu/comsdk"
path_to_pycomsdk
=
"/home/lbstr/bmstu/pycomsdk"
class
TestAdvancedParser
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
test_files_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"test_adot_files"
)
def
test_node_attributes_parsing
(
self
):
"""Проверка парсинга атрибутов узлов"""
parser
=
Parser
()
graph
=
parser
.
parse_file
(
os
.
path
.
join
(
self
.
test_files_dir
,
"node_attrs.adot"
))
# Проверка атрибутов состояния
state
=
graph
.
init_state
self
.
assertEqual
(
state
.
parallelization_policy
.
__class__
.
__name__
,
"ThreadParallelizationPolicy"
)
self
.
assertIsNotNone
(
state
.
selector
)
self
.
assertEqual
(
state
.
comment
,
"Test node with attributes"
)
def
test_edge_types_parsing
(
self
):
"""Проверка обработки разных типов ребер"""
parser
=
Parser
()
graph
=
parser
.
parse_file
(
os
.
path
.
join
(
self
.
test_files_dir
,
"edge_types.adot"
))
# Проверка обычного и многопоточного ребер
transfers
=
graph
.
init_state
.
transfers
self
.
assertEqual
(
transfers
[
0
]
.
edge
.
order
,
0
)
# ->
self
.
assertEqual
(
transfers
[
1
]
.
edge
.
order
,
1
)
# =>
def
test_subgraph_parsing
(
self
):
"""Тестирование встраивания подграфов"""
parser
=
Parser
()
graph
=
parser
.
parse_file
(
os
.
path
.
join
(
self
.
test_files_dir
,
"subgraph_test.adot"
))
# Проверка замены состояния подграфом
state
=
graph
.
init_state
self
.
assertTrue
(
hasattr
(
state
,
"_proxy_state"
))
self
.
assertEqual
(
len
(
state
.
_proxy_state
.
transfers
),
2
)
def
test_keys_mapping
(
self
):
"""Проверка преобразования ключей"""
parser
=
Parser
()
graph
=
parser
.
parse_file
(
os
.
path
.
join
(
self
.
test_files_dir
,
"keys_mapping.adot"
))
# Проверка настроек ключей для обработчика
edge
=
graph
.
init_state
.
transfers
[
0
]
.
edge
self
.
assertEqual
(
edge
.
_io_mapping
.
_keys_mapping
[
"local_key"
],
"global.key.path"
)
def
test_config_integration
(
self
):
"""Интеграция с внешними конфигурационными файлами"""
parser
=
Parser
()
graph
=
parser
.
parse_file
(
os
.
path
.
join
(
self
.
test_files_dir
,
"config_integration.adot"
))
# Проверка загрузки параметров из конфига
func
=
graph
.
init_state
.
transfers
[
0
]
.
edge
.
morph_f
self
.
assertEqual
(
func
.
module
,
"configured_module"
)
self
.
assertEqual
(
func
.
name
,
"configured_function"
)
def
test_error_handling
(
self
):
"""Проверка обработки ошибок"""
parser
=
Parser
()
with
self
.
assertRaises
(
Exception
)
as
context
:
parser
.
parse_file
(
os
.
path
.
join
(
self
.
test_files_dir
,
"invalid_syntax.adot"
))
self
.
assertIn
(
"Syntax error"
,
str
(
context
.
exception
))
def
test_pre_post_processors
(
self
):
"""Тестирование пре- и пост-процессоров"""
parser
=
Parser
()
graph
=
parser
.
parse_file
(
os
.
path
.
join
(
self
.
test_files_dir
,
"pre_post_processors.adot"
))
edge
=
graph
.
init_state
.
transfers
[
0
]
.
edge
self
.
assertIsNotNone
(
edge
.
preprocess
)
self
.
assertIsNotNone
(
edge
.
postprocess
)
class
ParserGoodCheck
(
unittest
.
TestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment