-
-
Notifications
You must be signed in to change notification settings - Fork 396
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
3 changed files
with
36 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from tests import testmodels | ||
from tortoise.contrib import test | ||
|
||
|
||
class TestCallableDefault(test.TestCase): | ||
async def test_default_create(self): | ||
model = await testmodels.CallableDefault.create() | ||
self.assertEqual(model.callable_default, "callable_default") | ||
self.assertEqual(model.async_default, "async_callable_default") | ||
|
||
async def test_default_by_save(self): | ||
saved_model = testmodels.CallableDefault() | ||
await saved_model.save() | ||
self.assertEqual(saved_model.callable_default, "callable_default") | ||
self.assertEqual(saved_model.async_default, "async_callable_default") | ||
|
||
async def test_async_default_change(self): | ||
default_change = testmodels.CallableDefault() | ||
default_change.async_default = "changed" | ||
await default_change.save() | ||
self.assertEqual(default_change.async_default, "changed") |
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