Passed
Push — master ( b50e97...feedcb )
by Humberto
01:28 queued 14s
created

tests.unit.v0x04.test_symmetric.test_hello   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 18
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A _new_list_of_elements() 0 7 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestHello.setUpClass() 0 8 1
1
"""Hello message tests."""
2
from pyof.v0x04.symmetric.hello import (
3
    Hello, HelloElemHeader, HelloElemType, ListOfHelloElements)
4
from tests.unit.test_struct import TestStruct
5
6
7
class TestHello(TestStruct):
8
    """Hello message tests (also those in :class:`.TestDump`)."""
9
10
    @classmethod
11
    def setUpClass(cls):
12
        """Configure raw file and its object in parent class (TestDump)."""
13
        super().setUpClass()
14
        super().set_raw_dump_file('v0x04', 'ofpt_hello')
15
        super().set_raw_dump_object(Hello, xid=62,
16
                                    elements=_new_list_of_elements())
17
        super().set_minimum_size(8)
18
19
20
def _new_list_of_elements():
21
    """Crate new ListOfHelloElements."""
22
    hello_elem = HelloElemHeader(HelloElemType.OFPHET_VERSIONBITMAP,
23
                                 length=8, content=b'\x00\x00\x00\x10')
24
    elements = ListOfHelloElements()
25
    elements.append(hello_elem)
26
    return elements
27