Passed
Pull Request — master (#161)
by Jan
04:20
created

tests.test_graph.test_bigOvalTree()   B

Complexity

Conditions 1

Size

Total Lines 76
Code Lines 59

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 59
nop 0
dl 0
loc 76
rs 8.3417
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
import pytest
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
introduced by
import missing from __future__ import absolute_import
Loading history...
2
3
from oval_graph.oval_node import OvalNode
4
5
import tests.any_test_help
6
7
missing_error_pattern = "Missing required argument!"
0 ignored issues
show
Coding Style Naming introduced by
Constant name "missing_error_pattern" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern ('(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
8
9
bad_value_error_pattern = (
0 ignored issues
show
Coding Style Naming introduced by
Constant name "bad_value_error_pattern" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern ('(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
10
    r'Wrong value of (negation|node_type|argument) (argument|value)(!| for (value|operator) node!)'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (99/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
11
    )
12
13
14
def test_bad_tree():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
15
    with pytest.raises(Exception, match="cannot contain any child"):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
16
        assert bad_tree()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
17
18
19
def test_bad_tree_only_and_no_child():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
20
    with pytest.raises(Exception, match="must have a child"):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
21
        assert tree_only_and()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
22
23
24
def test_bad_tree_only_or_no_child():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
25
    with pytest.raises(Exception, match="must have a child"):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
26
        assert tree_only_or()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
27
28
29
def test_bad_tree_with_bad_type_of_node():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_bad_tree_with_bad_type_of_node" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
30
    with pytest.raises(Exception, match=bad_value_error_pattern):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
31
        assert tree_with_bad_type()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
32
33
34
def test_bad_tree_with_bad_value_of_operator():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_bad_tree_with_bad_value_of_operator" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
35
    with pytest.raises(Exception, match=bad_value_error_pattern):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
36
        assert tree_with_bad_value_of_operator()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
37
38
39
def test_bad_tree_with_bad_value_of_value():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_bad_tree_with_bad_value_of_value" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
40
    with pytest.raises(Exception, match=bad_value_error_pattern):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
41
        assert tree_with_bad_value_of_value()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
42
43
44
def test_bad_tree_with_bad_value_of_negation():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_bad_tree_with_bad_value_of_negation" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
45
    with pytest.raises(Exception, match=bad_value_error_pattern):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
46
        assert tree_with_bad_value_of_negation()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
47
48
49
def test_bad_tree_with_miss_id_argument():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_bad_tree_with_miss_id_argument" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
50
    with pytest.raises(Exception, match=missing_error_pattern):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
51
        assert miss_id_argument()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
52
53
54
def test_bad_tree_with_miss_value_argument():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_bad_tree_with_miss_value_argument" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
55
    with pytest.raises(Exception, match=missing_error_pattern):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
56
        assert miss_value_argument()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
57
58
59
# degenered trees
60
61
62
def miss_id_argument():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
Useless return at end of function or method
Loading history...
63
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Unused Code introduced by
The variable tree seems to be unused.
Loading history...
64
        node_type='operator',
65
        value='and',
66
        children=[
67
            OvalNode(
68
                node_id=2,
69
                node_type='value',
70
                value="false",
71
            ),
72
        ]
73
    )
74
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
75
76
77
def miss_value_argument():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
Useless return at end of function or method
Loading history...
78
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Unused Code introduced by
The variable tree seems to be unused.
Loading history...
79
        node_id=1,
80
        node_type='operator',
81
        children=[
82
            OvalNode(
83
                node_id=2,
84
                node_type='value',
85
                value="false",
86
            ),
87
        ]
88
    )
89
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
90
91
92
def bad_tree():
0 ignored issues
show
Unused Code introduced by
Useless return at end of function or method
Loading history...
93
    """
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
94
         t
95
         |
96
        and
97
         |
98
         t
99
    """
100
    t = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Coding Style Naming introduced by
Variable name "t" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Unused Code introduced by
The variable t seems to be unused.
Loading history...
101
        node_id=1,
102
        node_type="value",
103
        value="true",
104
        children=[
105
            OvalNode(
106
                node_id=2,
107
                node_type="operator",
108
                value="and",
109
                children=[
110
                    OvalNode(
111
                        node_id=3,
112
                        node_type="value",
113
                        value="true",
114
                    ),
115
                ]
116
            ),
117
        ]
118
    )
119
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
120
121
122
def tree_only_or():
0 ignored issues
show
Unused Code introduced by
Useless return at end of function or method
Loading history...
123
    """
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
124
        or
125
    """
126
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Unused Code introduced by
The variable tree seems to be unused.
Loading history...
127
        node_id=1,
128
        node_type="operator",
129
        value='or',
130
    )
131
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
132
133
134
def tree_only_and():
0 ignored issues
show
Unused Code introduced by
Useless return at end of function or method
Loading history...
135
    """
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
136
        and
137
    """
138
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Unused Code introduced by
The variable tree seems to be unused.
Loading history...
139
        node_id=1,
140
        node_type="operator",
141
        value='and',
142
    )
143
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
144
145
146
def tree_with_bad_value_of_operator():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
Useless return at end of function or method
Loading history...
147
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Unused Code introduced by
The variable tree seems to be unused.
Loading history...
148
        node_id=1,
149
        node_type="operator",
150
        value='nad',
151
    )
152
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
153
154
155
def tree_with_bad_value_of_value():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
Useless return at end of function or method
Loading history...
156
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Unused Code introduced by
The variable tree seems to be unused.
Loading history...
157
        node_id=1,
158
        node_type="value",
159
        value='and',
160
    )
161
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
162
163
164
def tree_with_bad_type():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
Useless return at end of function or method
Loading history...
165
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Unused Code introduced by
The variable tree seems to be unused.
Loading history...
166
        node_id=1,
167
        node_type="car",
168
        value='and',
169
    )
170
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
171
172
173
def tree_with_bad_value_of_negation():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
Useless return at end of function or method
Loading history...
174
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Unused Code introduced by
The variable tree seems to be unused.
Loading history...
175
        node_id=1,
176
        node_type="operator",
177
        value="true",
178
        children=[
179
            OvalNode(
180
                node_id=2,
181
                node_type="value",
182
                value='true',
183
                negation="random_string",
184
            )
185
        ]
186
    )
187
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
188
189
# normal trees
190
191
192
def test_UPPERCASETree():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_UPPERCASETree" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
Unused Code introduced by
Useless return at end of function or method
Loading history...
193
    t = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Coding Style Naming introduced by
Variable name "t" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Unused Code introduced by
The variable t seems to be unused.
Loading history...
194
        node_id=1,
195
        node_type="OPERATOR",
196
        value="AND",
197
        children=[
198
            OvalNode(
199
                node_id=2,
200
                node_type="VALUE",
201
                value="TRUE",
202
            ),
203
            OvalNode(
204
                node_id=3,
205
                node_type="VALUE",
206
                value="NOTAPPL",
207
            ),
208
        ]
209
    )
210
    return
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
211
212
213
def test_bigOvalTree():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_bigOvalTree" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
214
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
215
        node_id=1,
216
        node_type='operator',
217
        value='and',
218
        children=[
219
            OvalNode(
220
                node_id=2,
221
                node_type='value',
222
                value="false",
223
            ),
224
            OvalNode(
225
                node_id=3,
226
                node_type='operator',
227
                value="xor",
228
                children=[
229
                    OvalNode(
230
                        node_id=4,
231
                        node_type='value',
232
                        value='true',
233
                    ),
234
                    OvalNode(
235
                        node_id=5,
236
                        node_type='operator',
237
                        value='one',
238
                        children=[
239
                            OvalNode(
240
                                node_id=6,
241
                                node_type='value',
242
                                value='noteval',
243
                            ),
244
                            OvalNode(
245
                                node_id=7,
246
                                node_type='value',
247
                                value='true',
248
                            ),
249
                            OvalNode(
250
                                node_id=8,
251
                                node_type='value',
252
                                value='notappl',
253
                            ),
254
                        ]
255
                    ),
256
                    OvalNode(
257
                        node_id=9,
258
                        node_type='value',
259
                        value='error',
260
                    ),
261
                ]
262
            ),
263
            OvalNode(
264
                node_id=10,
265
                node_type='operator',
266
                value='or',
267
                children=[
268
                    OvalNode(
269
                        node_id=11,
270
                        node_type='value',
271
                        value="unknown",
272
                    ),
273
                    OvalNode(
274
                        node_id=12,
275
                        node_type='value',
276
                        value="true",
277
                    ),
278
                ]
279
            ),
280
        ]
281
    )
282
283
    test_data_src = 'test_data/bigOvalTree.json'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
284
    dict_of_tree = tests.any_test_help.any_get_test_data_json(test_data_src)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
285
    tests.any_test_help.any_test_treeEvaluation_with_tree(tree, "false")
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
286
    tests.any_test_help.any_test_tree_to_dict_of_tree(tree, dict_of_tree)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
287
    tests.any_test_help.find_any_node(tree, 5)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
288
    tests.any_test_help.any_test_dict_to_tree(dict_of_tree)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
289
290
###################################################
291
292
293
def get_and_false_tree():
294
    """
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
295
        and
296
         |
297
         f
298
    """
299
    return OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
300
        node_id=1,
301
        node_type='operator',
302
        value='and',
303
        children=[
304
            OvalNode(
305
                node_id=2,
306
                node_type='value',
307
                value="false",
308
            ),
309
        ]
310
    )
311
312
313
def test_treeRepr():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_treeRepr" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
314
    assert str(get_and_false_tree()) == "and"
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
315
316
317
def test_add_to_tree():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
318
    test_data_src = 'test_data/add_to_tree.json'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
319
    dict_of_tree = tests.any_test_help.any_get_test_data_json(test_data_src)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
320
321
    tree = get_and_false_tree()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
322
    tree1 = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
323
        node_id=3,
324
        node_type='value',
325
        value="true",
326
    )
327
    tree.add_to_tree(1, tree1)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
328
    assert tree.save_tree_to_dict() == dict_of_tree
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
329
330
331
def test_ChangeValueTree():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_ChangeValueTree" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
332
    """
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
333
        and
334
        /|\
335
       t t or
336
          / \
337
         f   t
338
    """
339
    Tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Coding Style Naming introduced by
Variable name "Tree" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
340
        node_id=1,
341
        node_type='operator',
342
        value='and',
343
        children=[
344
            OvalNode(
345
                node_id=2,
346
                node_type='value',
347
                value="true",
348
            ),
349
            OvalNode(
350
                node_id=3,
351
                node_type='value',
352
                value="false",
353
            ),
354
            OvalNode(
355
                node_id=4,
356
                node_type='operator',
357
                value='or',
358
                children=[
359
                    OvalNode(
360
                        node_id=5,
361
                        node_type='value',
362
                        value="false",
363
                    ),
364
                    OvalNode(
365
                        node_id=6,
366
                        node_type='value',
367
                        value="true",
368
                    ),
369
                ]
370
            ),
371
        ]
372
    )
373
374
    Tree.change_tree_value(3, "true")
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
375
    tests.any_test_help.any_test_treeEvaluation_with_tree(Tree, "true")
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
376
377
378
def test_node_operator_negate():
379
    """
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
380
        !and
381
         |
382
         f
383
    """
384
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
385
        node_id=1,
386
        node_type='operator',
387
        value='and',
388
        negation=True,
389
        children=[
390
            OvalNode(
391
                node_id=2,
392
                node_type='value',
393
                value="false",
394
            ),
395
        ]
396
    )
397
    tests.any_test_help.any_test_treeEvaluation_with_tree(tree, "true")
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
398
399
400
def test_node_value_negate():
401
    """
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
402
        and
403
         |
404
         !f
405
    """
406
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
407
        node_id=1,
408
        node_type='operator',
409
        value='and',
410
        children=[
411
            OvalNode(
412
                node_id=2,
413
                node_type='value',
414
                value="false",
415
                negation=True,
416
            ),
417
        ]
418
    )
419
    tests.any_test_help.any_test_treeEvaluation_with_tree(tree, "true")
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
420
421
422
def test_node_value_negate1():
423
    """
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
424
        and
425
         |
426
         !t
427
    """
428
429
    tree = OvalNode(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
430
        node_id=1,
431
        node_type='operator',
432
        value='and',
433
        children=[
434
            OvalNode(
435
                node_id=2,
436
                node_type='value',
437
                value="true",
438
                negation=True,
439
            ),
440
        ]
441
    )
442
    tests.any_test_help.any_test_treeEvaluation_with_tree(tree, "false")
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
443