コード例 #1
0
ファイル: t1_serialization.py プロジェクト: NickChen0113/s3ql
def test_thaw_errors():
    buf = freeze_basic_mapping({ 'hello': 'world' })

    for s in (buf[1:], buf[:-1],
              b'"foo"[2]', b'open("/dev/null", "r")',
              b'"foo".__class__'):
        with pytest.raises(ThawError):
            thaw_basic_mapping(s)
コード例 #2
0
ファイル: t1_serialization.py プロジェクト: NickChen0113/s3ql
def test_simple():
    d = { 'hello': 42,
          'world': True,
          'data': b'fooxyz',
          'str': 'nice' }

    assert thaw_basic_mapping(freeze_basic_mapping(d)) == d