Complete base and alias inserts
This commit is contained in:
@@ -3,7 +3,10 @@ import unittest
|
||||
|
||||
# local imports
|
||||
from schiz import State
|
||||
from schiz.error import StateExists
|
||||
from schiz.error import (
|
||||
StateExists,
|
||||
StateInvalid,
|
||||
)
|
||||
|
||||
|
||||
class TestState(unittest.TestCase):
|
||||
@@ -31,5 +34,35 @@ class TestState(unittest.TestCase):
|
||||
states.add('foo')
|
||||
|
||||
|
||||
def test_alias(self):
|
||||
states = State(2)
|
||||
states.add('foo')
|
||||
states.add('bar')
|
||||
states.alias('baz', states.FOO | states.BAR)
|
||||
self.assertEqual(states.BAZ, 3)
|
||||
|
||||
|
||||
def test_alias_limit(self):
|
||||
states = State(2)
|
||||
states.add('foo')
|
||||
states.add('bar')
|
||||
states.alias('baz', states.FOO | states.BAR)
|
||||
|
||||
|
||||
def test_alias_nopure(self):
|
||||
states = State(3)
|
||||
with self.assertRaises(ValueError):
|
||||
states.alias('foo', 4)
|
||||
|
||||
|
||||
def test_alias_cover(self):
|
||||
states = State(3)
|
||||
states.add('foo')
|
||||
states.add('bar')
|
||||
with self.assertRaises(StateInvalid):
|
||||
states.alias('baz', 5)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user