~ubuntu-branches/debian/sid/pyrlp/sid

« back to all changes in this revision

Viewing changes to tests/test_invalid.py

  • Committer: Package Import Robot
  • Author(s): Ben Finney
  • Date: 2017-07-15 05:25:42 UTC
  • Revision ID: package-import@ubuntu.com-20170715052542-a20zzsypt1qfecq1
Tags: upstream-0.5.1
ImportĀ upstreamĀ versionĀ 0.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from __future__ import unicode_literals
 
2
 
 
3
import pytest
 
4
from rlp import decode, DecodingError
 
5
 
 
6
 
 
7
invalid_rlp = (
 
8
    b'',
 
9
    b'\x00\xab',
 
10
    b'\x00\x00\xff',
 
11
    b'\x83dogcat',
 
12
    b'\x83do',
 
13
    b'\xc7\xc0\xc1\xc0\xc3\xc0\xc1\xc0\xff',
 
14
    b'\xc7\xc0\xc1\xc0\xc3\xc0\xc1'
 
15
    b'\x81\x02',
 
16
    b'\xb8\x00',
 
17
    b'\xb9\x00\x00',
 
18
    b'\xba\x00\x02\xff\xff',
 
19
    b'\x81\x54'
 
20
)
 
21
 
 
22
 
 
23
def test_invalid_rlp():
 
24
    for serial in invalid_rlp:
 
25
        with pytest.raises(DecodingError):
 
26
            decode(serial)