-
Notifications
You must be signed in to change notification settings - Fork 16
/
test_utils.py
67 lines (56 loc) · 1.26 KB
/
test_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
from robotkernel.utils import detect_robot_context
def test_detect_robot_context_root():
assert detect_robot_context('', -1) == '__root__'
assert detect_robot_context("""\
*** Variables ***
""", -1) == '__root__'
assert detect_robot_context(
"""\
*** Settings ***
*** Variables ***
""", -1
) == '__root__'
def test_detect_robot_context_settings():
assert detect_robot_context(
"""\
*** Settings ***
""", -1
) == '__settings__'
assert detect_robot_context(
"""\
*** Settings ***
*** Tasks ***
""", len('*** Settings ***')
) == '__settings__'
def test_detect_robot_context_tasks():
assert detect_robot_context(
"""\
*** Test Cases ***
This is a test case
With a keyword and param
""", -1
) == '__tasks__'
assert detect_robot_context(
"""\
*** Settings ***
*** Test Cases ***
This is a test case
With a keyword and param
""", -1
) == '__tasks__'
assert detect_robot_context(
"""\
*** Settings ***
*** Tasks ***
This is a task
With a keyword and param
""", -1
) == '__tasks__'
#
# def test_detect_robot_context_keywords():
# assert detect_robot_context(
# """\
# *** Keywords ***
# """, -1
# ) == '__keywords__'