/usr/lib/python2.7/dist-packages/preggy/assertions/inclusion.py is in python-preggy 1.1.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # -*- coding: utf-8 -*-
'''preggy inclusion assertion. For use with `expect()` (see `preggy.core`).
'''
# preggy assertions
# https://github.com/heynemann/preggy
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 Bernardo Heynemann heynemann@gmail.com
from __future__ import absolute_import
try:
import six
except ImportError: # pragma: no cover
import warnings
warnings.warn("Ignoring six. Probably setup.py installing package.")
from preggy import create_assertions
@create_assertions
def to_include(topic, expected):
'''Asserts that `expected` is in `topic`.'''
if isinstance(topic, six.string_types + tuple([six.binary_type, six.text_type])):
return str(expected) in topic
return expected in topic
|