-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
44 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,6 +190,20 @@ def test_06_transaction_failed(self): | |
pass | ||
self.assertIsNone(UserInfo.get_one(email='[email protected]')) | ||
|
||
def test_07_duplicate_key(self): | ||
ui = UserInfo.new( | ||
email='[email protected]', username='dennias', height=180, | ||
properties={"yooyo": "hahaha"}) | ||
try: | ||
with ui.start_transaction() as _t: | ||
ui.insert(t=_t) | ||
# test tidb pessimic Pessimistic Lock | ||
self.assertTrue(False) | ||
except Exception as ex: | ||
self.assertEqual(type(ex), pymysql.err.IntegrityError) | ||
self.assertEqual(str(ex), """(1062, "Duplicate entry '[email protected]' for key 'email'")""") | ||
self.assertIsNone(UserInfo.get_one(email='[email protected]')) | ||
|
||
def test_99_drop_table(self): | ||
with UserInfo.start_transaction() as _t: | ||
UserInfo.drop(t=_t) | ||
|