def test_bad_value_types(self): p = {"string": True} assert not sensehat_listener.validStringPost(p) p = {"string": "Str", "colour": True} assert not sensehat_listener.validStringPost(p) p = {"string": "Str", "background": True} assert not sensehat_listener.validStringPost(p) p = { "string": "Str", "speed": "String" } #Bool is a subclass of int apparently assert not sensehat_listener.validStringPost(p)
def test_all_keys_case(self): p = { "string": "a", "colour": [0, 0, 50], "background": [50, 0, 0], "speed": 0.1 } assert sensehat_listener.validStringPost(p)
def test_extra_keys(self): p = {"string": "abcdefghijklmnopqrstuvwxyz1234567", "badkey": True} assert not sensehat_listener.validStringPost(p)
def test_too_long_string_case(self): p = {"string": "abcdefghijklmnopqrstuvwxyz1234567"} assert not sensehat_listener.validStringPost(p)
def test_empty_case(self): p = {} assert not sensehat_listener.validStringPost(p)
def test_int_speed_case(self): p = {"string": "a", "speed": 1} assert sensehat_listener.validStringPost(p)
def test_minimal_case(self): p = {"string": "a"} assert sensehat_listener.validStringPost(p)