From: Toni Karppi Date: Thu, 21 Feb 2019 19:22:48 +0000 (-0500) Subject: Add test to as_interface when no cls or methods X-Git-Tag: rel_1_3_0~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40401d7933aa9c241a4f8064085efdd5e25f1dbf;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add test to as_interface when no cls or methods Fixes #4511 ### Description The `as_interface` function requires that an argument be provided for at least one of the parameters `cls` or `methods`. There was no test that tested the case when neither of these arguments were provided. ### Checklist This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [x] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #` in the commit message - please include tests. **Have a nice day!** Closes: #4512 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4512 Pull-request-sha: 156f6af95ede730d2e1a9d2c935c830cf3cfc96e Change-Id: Ifa23dbe1dbe9a824fe680e4947b81c96a50c133f --- diff --git a/test/base/test_utils.py b/test/base/test_utils.py index b27379248d..e96162703b 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -2305,6 +2305,10 @@ class AsInterfaceTest(fixtures.TestBase): class Object(object): pass + def test_no_cls_no_methods(self): + obj = object() + assert_raises(TypeError, util.as_interface, obj) + def test_instance(self): obj = object() assert_raises(TypeError, util.as_interface, obj, cls=self.Something)