From 17649c939901573af53beeeeb9d7be08102d1503 Mon Sep 17 00:00:00 2001 From: Nat Williams Date: Tue, 17 Apr 2012 14:42:57 -0500 Subject: more specific exception for missing Request classes --- pygithub3/exceptions.py | 2 +- pygithub3/requests/base.py | 12 ++++++------ pygithub3/tests/requests/test_core.py | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'pygithub3') diff --git a/pygithub3/exceptions.py b/pygithub3/exceptions.py index a467256..20cf058 100644 --- a/pygithub3/exceptions.py +++ b/pygithub3/exceptions.py @@ -8,7 +8,7 @@ class InvalidBodySchema(Exception): pass -class DoesNotExists(Exception): +class RequestDoesNotExist(Exception): """ Raised when `Request` factory can't find the subclass """ pass diff --git a/pygithub3/requests/base.py b/pygithub3/requests/base.py index 582a73f..d3e18a3 100644 --- a/pygithub3/requests/base.py +++ b/pygithub3/requests/base.py @@ -7,8 +7,8 @@ try: except ImportError: import json -from pygithub3.exceptions import (DoesNotExists, UriInvalid, ValidationError, - InvalidBodySchema) +from pygithub3.exceptions import (RequestDoesNotExist, UriInvalid, + ValidationError, InvalidBodySchema) from pygithub3.resources.base import Raw from pygithub3.core.utils import import_module @@ -126,11 +126,11 @@ class Factory(object): % (ABS_IMPORT_PREFIX, module_chunk)) request = getattr(module, request_chunk) except ImportError: - raise DoesNotExists("'%s' module does not exists" - % module_chunk) + raise RequestDoesNotExist("'%s' module does not exist" + % module_chunk) except AttributeError: - raise DoesNotExists( - "'%s' request doesn't exists into '%s' module" + raise RequestDoesNotExist( + "'%s' request does not exist in '%s' module" % (request_chunk, module_chunk)) return func(self, request, **kwargs) return wrapper diff --git a/pygithub3/tests/requests/test_core.py b/pygithub3/tests/requests/test_core.py index 9fcec10..4632056 100644 --- a/pygithub3/tests/requests/test_core.py +++ b/pygithub3/tests/requests/test_core.py @@ -6,8 +6,8 @@ from nose.tools import raises from pygithub3.tests.utils.core import TestCase from pygithub3.requests.base import Factory, Body, json, Request -from pygithub3.exceptions import (UriInvalid, DoesNotExists, ValidationError, - InvalidBodySchema) +from pygithub3.exceptions import (UriInvalid, RequestDoesNotExist, + ValidationError, InvalidBodySchema) from pygithub3.tests.utils.base import (mock_json, DummyRequest, DummyRequestValidation) from pygithub3.tests.utils.requests import ( @@ -29,8 +29,8 @@ class TestFactory(TestCase): self.assertRaises(UriInvalid, self.f, '.invalid') def test_BUILDER_with_fake_action(self): - self.assertRaises(DoesNotExists, self.f, 'users.fake') - self.assertRaises(DoesNotExists, self.f, 'fake.users') + self.assertRaises(RequestDoesNotExist, self.f, 'users.fake') + self.assertRaises(RequestDoesNotExist, self.f, 'fake.users') def test_BUILDER_builds_users(self): """ Users.get as real test because it wouldn't be useful mock -- cgit v1.2.3-59-g8ed1b