Ejemplo n.º 1
0
def test_is_nostation3(chunk2):
    """parsing a no-station address should return True in is_nostation()"""
    genericframe = GenericFrame()
    genericframe.parse_address(chunk2)
    assert genericframe.is_nostation() is True
Ejemplo n.º 2
0
def test_is_allstation3(chunk2):
    """"given a no-station address, testing is_allstation should yield False"""
    genericframe = GenericFrame()
    genericframe.parse_address(chunk2)
    assert genericframe.is_allstation() is False
Ejemplo n.º 3
0
def test_is_nostation2(chunk1):
    """parsing a all-station address should return False on is_nostation()"""
    genericframe = GenericFrame()
    genericframe.parse_address(chunk1)
    assert genericframe.is_nostation() is False
Ejemplo n.º 4
0
def test_parse_address9(chunk4):
    """parse I-frame control field with 1 byte address"""
    genericframe = GenericFrame()
    genericframe.parse_address(chunk4)
Ejemplo n.º 5
0
def test_is_allstation1(chunk1):
    """test frame generated with unicast/allstation address for having one"""
    genericframe = GenericFrame()
    genericframe.parse_address(chunk1)
    assert genericframe.is_allstation() is True
Ejemplo n.º 6
0
def test_parse_address7():
    """unstripped input, 4 bytes, invalid closing flags"""
    genericframe = GenericFrame()
    with pytest.raises(ValueError):
        genericframe.parse_address(b'\x7e\x00\x00\x42')
Ejemplo n.º 7
0
def test_parse_address4():
    """stripped input: just two zero-bytes"""
    genericframe = GenericFrame()
    with pytest.raises(ValueError):
        genericframe.parse_address(bytes(2))
Ejemplo n.º 8
0
def test_parse_address3():
    """test for too short bytearray """
    genericframe = GenericFrame()
    with pytest.raises(TypeError):
        genericframe.parse_address(bytearray(1))
Ejemplo n.º 9
0
def test_parse_address2():
    """test for rejecting float input"""
    genericframe = GenericFrame()
    with pytest.raises(TypeError):
        genericframe.parse_address(2.3)
Ejemplo n.º 10
0
def test_parse_address1():
    """test for rejecting strings"""
    genericframe = GenericFrame()
    with pytest.raises(TypeError):
        genericframe.parse_address('test')