File: test_errors.py

package info (click to toggle)
python-clickhouse-driver 0.2.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,516 kB
  • sloc: python: 10,950; pascal: 42; makefile: 29; sh: 3
file content (17 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pickle

import clickhouse_driver.errors as err


def picklable(o):
    picked = pickle.loads(pickle.dumps(o))
    assert repr(o) == repr(picked)
    assert str(o) == str(picked)


def test_exception_picklable():
    picklable(err.Error('foo'))
    picklable(err.Error(message='foo'))

    picklable(err.ServerException('foo', 0, Exception()))
    picklable(err.ServerException(message='foo', code=0, nested=Exception()))