# Path: groupy/utils.py
# def urljoin(base, path=None):
# def parse_share_url(share_url):
# def get_rfc3339(when):
# def get_datetime(timestamp):
#     def __init__(self, key, value):
#     def __repr__(self):
#     def __call__(self, obj):
#     def __init__(self, tests):
#     def __call__(self, objects):
#     def find(self, objects):
#     def passes(self, obj):
# def make_filter(**tests):
# class AttrTest:
# class Filter:
# 
# Path: groupy/exceptions.py
# class GroupyError(Exception):
# class MissingMembershipError(GroupyError):
# class FindError(GroupyError):
# class NoMatchesError(FindError):
# class MultipleMatchesError(FindError):
# class ApiError(GroupyError):
# class NoResponse(ApiError):
# class BadResponse(ApiError):
# class InvalidJsonError(BadResponse):
# class MissingResponseError(BadResponse):
# class MissingMetaError(BadResponse):
# class ResultsError(ApiError):
# class ResultsNotReady(ResultsError):
# class ResultsExpired(ResultsError):
#     def __init__(self, message=None):
#     def __init__(self, group_id, user_id, message=None):
#     def __init__(self, message, objects, tests, matches=None):
#     def __init__(self, objects, tests):
#     def __init__(self, objects, tests, matches):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, response, message=None):
#     def _extract_message(self, response):
#     def __init__(self, response, message='The JSON was incomplete/invalid'):
#     def __init__(self, response, message='The response contained no response data'):
#     def __init__(self, response, message='The response contained no meta data'):
#     def __init__(self, response, message):
#     def __init__(self, response, message='The results are not ready yet'):
#     def __init__(self, response, message='The results have expired'):


import unittest
from unittest import mock
from groupy import utils
from groupy import exceptions

    def test_share_token_is_correct(self):
        self.assertEqual(self.share_token, 'share_token')


class TrailingSlashParseShareUrlTests(ParseShareUrlTests):
    url = 'http://example.com/foo/group_id/share_token/'


class FilterTests(unittest.TestCase):
    def setUp(self):
        self.objects = [
            mock.Mock(foo='foo', baz=0),
            mock.Mock(foo='bar', baz=1),
            mock.Mock(foo='baz', baz=2),
            mock.Mock(foo='qux', baz=3),
        ]

    def test_find(self):
        f = utils.make_filter(foo__gt='foo')
        match = f.find(self.objects)
        self.assertEqual(match, self.objects[3])

    def test_filter(self):
        f = utils.make_filter(baz__gt=1)
        matches = list(f(self.objects))
        self.assertEqual(matches, self.objects[2:4])

    def test_no_matches(self):
        f = utils.make_filter(foobar='barfoo')

# Path: groupy/utils.py
# def urljoin(base, path=None):
# def parse_share_url(share_url):
# def get_rfc3339(when):
# def get_datetime(timestamp):
#     def __init__(self, key, value):
#     def __repr__(self):
#     def __call__(self, obj):
#     def __init__(self, tests):
#     def __call__(self, objects):
#     def find(self, objects):
#     def passes(self, obj):
# def make_filter(**tests):
# class AttrTest:
# class Filter:
# 
# Path: groupy/exceptions.py
# class GroupyError(Exception):
# class MissingMembershipError(GroupyError):
# class FindError(GroupyError):
# class NoMatchesError(FindError):
# class MultipleMatchesError(FindError):
# class ApiError(GroupyError):
# class NoResponse(ApiError):
# class BadResponse(ApiError):
# class InvalidJsonError(BadResponse):
# class MissingResponseError(BadResponse):
# class MissingMetaError(BadResponse):
# class ResultsError(ApiError):
# class ResultsNotReady(ResultsError):
# class ResultsExpired(ResultsError):
#     def __init__(self, message=None):
#     def __init__(self, group_id, user_id, message=None):
#     def __init__(self, message, objects, tests, matches=None):
#     def __init__(self, objects, tests):
#     def __init__(self, objects, tests, matches):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, response, message=None):
#     def _extract_message(self, response):
#     def __init__(self, response, message='The JSON was incomplete/invalid'):
#     def __init__(self, response, message='The response contained no response data'):
#     def __init__(self, response, message='The response contained no meta data'):
#     def __init__(self, response, message):
#     def __init__(self, response, message='The results are not ready yet'):
#     def __init__(self, response, message='The results have expired'):


# Path: tests/test_utils.py
import unittest
from unittest import mock
from groupy import utils
from groupy import exceptions


    def test_share_token_is_correct(self):
        self.assertEqual(self.share_token, 'share_token')


class TrailingSlashParseShareUrlTests(ParseShareUrlTests):
    url = 'http://example.com/foo/group_id/share_token/'


class FilterTests(unittest.TestCase):
    def setUp(self):
        self.objects = [
            mock.Mock(foo='foo', baz=0),
            mock.Mock(foo='bar', baz=1),
            mock.Mock(foo='baz', baz=2),
            mock.Mock(foo='qux', baz=3),
        ]

    def test_find(self):
        f = utils.make_filter(foo__gt='foo')
        match = f.find(self.objects)
        self.assertEqual(match, self.objects[3])

    def test_filter(self):
        f = utils.make_filter(baz__gt=1)
        matches = list(f(self.objects))
        self.assertEqual(matches, self.objects[2:4])

    def test_no_matches(self):
        f = utils.make_filter(foobar='barfoo')

        with self.assertRaises(exceptions.NoMatchesError):