mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
Merge pull request #159 from atharvaw/master
Increasing test coverage for encoding in enum
This commit is contained in:
commit
212792f98a
BIN
myhdl/test/core/setuptools-20.3.1.zip
Normal file
BIN
myhdl/test/core/setuptools-20.3.1.zip
Normal file
Binary file not shown.
@ -32,7 +32,7 @@ random.seed(1) # random, but deterministic
|
||||
|
||||
t_State = enum("SEARCH", "CONFIRM", "SYNC")
|
||||
t_Homograph = enum("SEARCH", "CONFIRM", "SYNC")
|
||||
|
||||
t_incomplete = enum("SEARCH", "CONFIRM")
|
||||
|
||||
class TestEnum:
|
||||
|
||||
@ -62,3 +62,26 @@ class TestEnum:
|
||||
e = copy.deepcopy(t_State.SEARCH)
|
||||
assert e == t_State.SEARCH
|
||||
assert e != t_State.CONFIRM
|
||||
|
||||
## Adding test coverage for encoding in enum
|
||||
|
||||
def testItemNotDeepCopy(self):
|
||||
e = copy.copy(t_State.SEARCH)
|
||||
assert e == t_State.SEARCH
|
||||
assert e != t_State.CONFIRM
|
||||
|
||||
def testWrongEncoding(self):
|
||||
def logic1(encoding):
|
||||
t_State = enum("SEARCH", "CONFIRM", "SYNC",encoding=encoding)
|
||||
with pytest.raises(ValueError):
|
||||
logic1(encoding)
|
||||
|
||||
def testNotStringtype(self):
|
||||
with pytest.raises(TypeError):
|
||||
t_State = enum("SEARCH", 1, "SYNC")
|
||||
|
||||
def testEnumLength(self):
|
||||
l = len(t_State)
|
||||
assert l == len(t_State)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user