Skip to content

Commit

Permalink
na
Browse files Browse the repository at this point in the history
  • Loading branch information
washad committed Jul 2, 2019
2 parents 9562cb3 + f1468bd commit c1da363
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 0 additions & 1 deletion pyrediseasyio/io/io_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,3 @@ def get_attributes(self, *args, **kwargs):




1 change: 1 addition & 0 deletions pyrediseasyio/io/single_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,4 @@ def write(self, value):
value = self._convert_type(value)
self._reader_writer.write(self.key, value)


20 changes: 17 additions & 3 deletions tests/test_read_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestGroup(IOGroup):
Float1 = FloatIO("Float 1", "Float1", default=1.2)

def __init__(self):
super().__init__(channel="TestChannel", delete_keys_on_startup = True)
super().__init__(channel="TestChannel")


class TestGroup2(IOGroup):
Expand All @@ -24,7 +24,7 @@ class TestGroup2(IOGroup):
Message1 = StringIO("String 1", "String1")

def __init__(self):
super().__init__(channel="TestChannel", delete_keys_on_startup=True)
super().__init__(channel="TestChannel")


class TestGroup3(IOGroup):
Expand All @@ -34,7 +34,7 @@ def __init__(self, db=2):
self.Int1 = IntIO("Integer 1", "Int1")
self.Int2 = IntIO("Integer 2", "Int2", default=34)
self.Float1 = FloatIO("Float 1", "Float1", default=1.2)
super().__init__(db=db, delete_keys_on_startup=True)
super().__init__(db=db)


class TestReadWrite(unittest.TestCase):
Expand Down Expand Up @@ -145,3 +145,17 @@ def test_that_pubsub_possible_on_io_group(self):

assert_that("This is a test" in msg[1]).is_true()


def test_values_can_be_set_to_default(self):
group1 = self.group
group1.Bool1 = True
group1.Float1 = 99

assert_that(group1.Bool1).is_true()
assert_that(group1.Float1).is_equal_to(99)

group1.set_all_to_defaults()
assert_that(group1.Bool1).is_false()
assert_that(group1.Float1).is_equal_to(1.2)


0 comments on commit c1da363

Please sign in to comment.