def test_decode_watermark_appended():
    watermark_uuid = uuid.uuid4()
    watermark = uuid_to_watermark(watermark_uuid)
    text = 'asdf'
    assert decode_watermark(''.join((text, watermark))) == (
        text,
        watermark_uuid,
    )
def test_decode_watermark_returns_original_encoded_text_if_too_short():
    encoded_text = 'asdf'
    assert decode_watermark(encoded_text) == (encoded_text, None)
def test_decode_watermark_returns_original_encoded_text_if_no_watermark():
    encoded_text = 'a' * 65
    assert decode_watermark(encoded_text) == (encoded_text, None)
def test_decode_watermark_requires_unicode_encoded_text():
    with pytest.raises(ValueError) as excinfo:
        decode_watermark(b'bytestring')
    excinfo.match('text must be a unicode string')