mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix the ability to copy the state, now copying the state will return the same state.
This commit is contained in:
parent
adfc89f125
commit
eeacd1019a
3 changed files with 19 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from copy import deepcopy, copy
|
||||
from inspect import isclass
|
||||
|
||||
import pytest
|
||||
|
|
@ -50,3 +51,14 @@ class TestStateFilter:
|
|||
async def test_filter(self, state, current_state, result):
|
||||
f = StateFilter(state=state)
|
||||
assert bool(await f(obj=Update(update_id=42), raw_state=current_state)) is result
|
||||
|
||||
@pytestmark
|
||||
async def test_state_copy(self):
|
||||
class SG(StatesGroup):
|
||||
state = State()
|
||||
|
||||
assert SG.state is deepcopy(SG.state)
|
||||
assert SG.state is copy(SG.state)
|
||||
|
||||
assert SG is copy(SG)
|
||||
assert SG is deepcopy(SG)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue