Esempio n. 1
0
def test_identifier_repr_does_the_trick2(capsys):
    i = Identifier(101 | CAN_EXTENDED_ID)
    assert eval(repr(i)) == Identifier(101 | CAN_EXTENDED_ID)
Esempio n. 2
0
def test_identifier_repr_works2(capsys):
    i = Identifier(101 | CAN_EXTENDED_ID)
    print(repr(i), end="")
    captured = capsys.readouterr()
    assert captured.out == "Identifier(0x80000065)"
Esempio n. 3
0
def test_identifier_repr_does_the_trick1(capsys):
    i = Identifier(101)
    assert eval(repr(i)) == Identifier(101)
Esempio n. 4
0
def test_identifier_repr_works1(capsys):
    i = Identifier(101)
    print(repr(i), end="")
    captured = capsys.readouterr()
    assert captured.out == "Identifier(0x00000065)"
Esempio n. 5
0
def test_identifier_str_works2(capsys):
    i = Identifier(101 | CAN_EXTENDED_ID)
    print(str(i), end="")
    captured = capsys.readouterr()
    assert captured.out == "Identifier(id = 0x00000065, is_extended = True)"
Esempio n. 6
0
def test_identifier_outof_range_raises2():
    with pytest.raises(IdentifierOutOfRangeError):
        Identifier(MAX_11_BIT_IDENTIFIER + 10)
Esempio n. 7
0
def test_identifier_str_works1(capsys):
    i = Identifier(101)
    print(str(i), end="")
    captured = capsys.readouterr()
    assert captured.out == "Identifier(id = 0x00000065, is_extended = False)"
Esempio n. 8
0
def test_identifier_outof_range_raises1():
    with pytest.raises(IdentifierOutOfRangeError):
        Identifier(CAN_EXTENDED_ID | (MAX_29_BIT_IDENTIFIER + 10))
Esempio n. 9
0
def test_identifier_max_works2():
    i = Identifier(MAX_11_BIT_IDENTIFIER)
    assert i.id == MAX_11_BIT_IDENTIFIER
    assert i.is_extended is False
    assert i.raw_id == MAX_11_BIT_IDENTIFIER
Esempio n. 10
0
def test_identifier_max_works1():
    i = Identifier(CAN_EXTENDED_ID | MAX_29_BIT_IDENTIFIER)
    assert i.id == MAX_29_BIT_IDENTIFIER
    assert i.is_extended is True
    assert i.raw_id == CAN_EXTENDED_ID | MAX_29_BIT_IDENTIFIER
Esempio n. 11
0
def test_identifier_works2():
    i = Identifier(111)
    assert i.id == 111
    assert i.is_extended is False
    assert i.raw_id == 111
Esempio n. 12
0
def test_identifier_works1():
    i = Identifier(CAN_EXTENDED_ID | 4711)
    assert i.id == 4711
    assert i.is_extended is True
    assert i.raw_id == CAN_EXTENDED_ID | 4711