Fix StaticField + tests for StaticField and unset optional TextField

This commit is contained in:
Mark Riedesel 2021-09-03 05:45:01 -05:00
parent 558e3fd232
commit 0bd82e09c4
4 changed files with 20 additions and 10 deletions

View file

@ -7,6 +7,7 @@ from pyaccuwage.fields import MoneyField
from pyaccuwage.fields import StateField
from pyaccuwage.fields import TextField
from pyaccuwage.fields import ZeroField
from pyaccuwage.fields import StaticField
from pyaccuwage.model import Model
class TestModelOutput(unittest.TestCase):
@ -20,7 +21,8 @@ class TestModelOutput(unittest.TestCase):
money = MoneyField(max_length=32)
state_txt = StateField()
state_num = StateField(use_numeric=True)
blank2 = BlankField(max_length=24)
blank2 = BlankField(max_length=12)
static1 = StaticField(value='hey mister!!')
def setUp(self):
self.model = TestModelOutput.TestModel()
@ -42,7 +44,8 @@ class TestModelOutput(unittest.TestCase):
b'313377'.zfill(32),
b'IA',
b'19',
b' ' * 24,
b' ' * 12,
b'hey mister!!',
])
output = model.output()
@ -64,6 +67,7 @@ field2: 12345
money: 3133.77
state_txt: IA
state_num: IA
static1: hey mister!!
''')