# Path: pythoscope/compat.py
# def all(iterable):
# def any(iterable):
# def sorted(iterable, compare=cmp, key=None):
#     def __init__(self, iterable, key=None):
#     def __iter__(self):
#     def next(self):
#     def _grouper(self, tgtkey):
# def samefile(file1, file2):
# class groupby(object):
# 
# Path: pythoscope/util.py
# def quoted_block(text):
#     return ''.join(["> %s" % line for line in text.splitlines(True)])


import difflib
import re
from nose.tools import assert_equal, assert_not_equal, assert_raises
from pythoscope.compat import set
from pythoscope.util import quoted_block

    # Our assertions.
    "assert_contains",
    "assert_contains_once",
    "assert_contains_one_after_another",
    "assert_doesnt_contain",
    "assert_equal_sets",
    "assert_equal_strings",
    "assert_function",
    "assert_instance",
    "assert_length",
    "assert_matches",
    "assert_not_raises",
    "assert_single_class",
    "assert_single_function",
    "assert_one_element_and_return"]


def assert_contains(haystack, needle):
    assert needle in haystack,\
           "Expected\n%s\nto contain %r, but it didn't." % (quoted_block(haystack), needle)

def assert_contains_once(haystack, needle):
    repeated = len(re.findall(re.escape(needle), haystack))
    assert repeated == 1, "Expected\n%s\nto contain %r once, but it contained it %d times instead." %\
           (quoted_block(haystack), needle, repeated)

def assert_contains_one_after_another(haystack, needle1, needle2):
    assert re.search(''.join([needle1, '.*', needle2]), haystack, re.DOTALL), \
        "Expected\n%s\nto contain %r and then %r, but it didn't." %\

# Path: pythoscope/compat.py
# def all(iterable):
# def any(iterable):
# def sorted(iterable, compare=cmp, key=None):
#     def __init__(self, iterable, key=None):
#     def __iter__(self):
#     def next(self):
#     def _grouper(self, tgtkey):
# def samefile(file1, file2):
# class groupby(object):
# 
# Path: pythoscope/util.py
# def quoted_block(text):
#     return ''.join(["> %s" % line for line in text.splitlines(True)])


# Path: test/assertions.py
import difflib
import re
from nose.tools import assert_equal, assert_not_equal, assert_raises
from pythoscope.compat import set
from pythoscope.util import quoted_block


    # Our assertions.
    "assert_contains",
    "assert_contains_once",
    "assert_contains_one_after_another",
    "assert_doesnt_contain",
    "assert_equal_sets",
    "assert_equal_strings",
    "assert_function",
    "assert_instance",
    "assert_length",
    "assert_matches",
    "assert_not_raises",
    "assert_single_class",
    "assert_single_function",
    "assert_one_element_and_return"]


def assert_contains(haystack, needle):
    assert needle in haystack,\
           "Expected\n%s\nto contain %r, but it didn't." % (quoted_block(haystack), needle)

def assert_contains_once(haystack, needle):
    repeated = len(re.findall(re.escape(needle), haystack))
    assert repeated == 1, "Expected\n%s\nto contain %r once, but it contained it %d times instead." %\
           (quoted_block(haystack), needle, repeated)

def assert_contains_one_after_another(haystack, needle1, needle2):
    assert re.search(''.join([needle1, '.*', needle2]), haystack, re.DOTALL), \
        "Expected\n%s\nto contain %r and then %r, but it didn't." %\

           (quoted_block(haystack), needle1, needle2)