Skip to content

Commit 6e90139

Browse files
committed
clean up a bit tests and error
1 parent 232505f commit 6e90139

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

gino/engine.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ async def one_or_none(self, clause, *multiparams, **params):
344344
if len(ret) == 1:
345345
return ret[0]
346346

347-
raise MultipleResultsFound('Multiple rows found for one_or_none().')
347+
raise MultipleResultsFound('Multiple rows found for one_or_none()')
348348

349349
async def one(self, clause, *multiparams, **params):
350350
"""
@@ -361,10 +361,10 @@ async def one(self, clause, *multiparams, **params):
361361
try:
362362
ret = await self.one_or_none(clause, *multiparams, **params)
363363
except MultipleResultsFound:
364-
raise MultipleResultsFound('Multiple rows found for one().')
364+
raise MultipleResultsFound('Multiple rows found for one()')
365365

366366
if ret is None:
367-
raise NoResultFound('No row was found for one().')
367+
raise NoResultFound('No row was found for one()')
368368

369369
return ret
370370

tests/test_executemany.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,6 @@ async def test_one_or_none(bind):
7171
with pytest.raises(MultipleResultsFound):
7272
row = await User.query.gino.one_or_none()
7373

74-
result = await User.insert().gino.one_or_none(
75-
dict(name='3'), dict(name='4'))
76-
assert result is None
77-
rows = await User.query.gino.all()
78-
assert len(rows) == 5
79-
assert set(u.nickname for u in rows) == {'0', '1', '2', '3', '4'}
80-
81-
with pytest.raises(MultipleResultsFound):
82-
row = await User.query.gino.one_or_none()
83-
8474

8575
# noinspection PyUnusedLocal
8676
async def test_one(bind):
@@ -101,15 +91,6 @@ async def test_one(bind):
10191
with pytest.raises(MultipleResultsFound):
10292
row = await User.query.gino.one()
10393

104-
with pytest.raises(NoResultFound):
105-
await User.insert().gino.one(dict(name='3'), dict(name='4'))
106-
rows = await User.query.gino.all()
107-
assert len(rows) == 5
108-
assert set(u.nickname for u in rows) == {'0', '1', '2', '3', '4'}
109-
110-
with pytest.raises(MultipleResultsFound):
111-
row = await User.query.gino.one()
112-
11394

11495
# noinspection PyUnusedLocal
11596
async def test_scalar(bind):

0 commit comments

Comments
 (0)