import pickle from sentinel import Sentinel class PlainSentinel(Sentinel): pass class SentinelCustomRepr(Sentinel): repr = '***SentinelRepr***' def test_repr(): assert repr(PlainSentinel) == 'PlainSentinel' def test_pickle(): s = pickle.dumps(PlainSentinel) ps = pickle.loads(s) assert ps is PlainSentinel def test_custom_repr(): assert repr(SentinelCustomRepr) == '***SentinelRepr***' def test_sentinel_comes_ready_to_use(): assert repr(Sentinel) == 'Sentinel' s = pickle.dumps(Sentinel) ps = pickle.loads(s) assert ps is Sentinel