diff options
| author | Toni Karppi <karppitoni@gmail.com> | 2019-02-21 14:22:48 -0500 |
|---|---|---|
| committer | sqla-tester <sqla-tester@sqlalchemy.org> | 2019-02-21 14:22:48 -0500 |
| commit | 40401d7933aa9c241a4f8064085efdd5e25f1dbf (patch) | |
| tree | 34828af25291bd7b8961765cfb4062e0b147090c /test/base | |
| parent | eed102f4653d9a5af325e993fe3c402d2e600fdc (diff) | |
| download | sqlalchemy-40401d7933aa9c241a4f8064085efdd5e25f1dbf.tar.gz | |
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
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)
-->
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: #<issue number>` 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: #<issue number>` 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
Diffstat (limited to 'test/base')
| -rw-r--r-- | test/base/test_utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/base/test_utils.py b/test/base/test_utils.py index b27379248..e96162703 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) |
