Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 def test_extra_keys(self):
     p = {"string": "abcdefghijklmnopqrstuvwxyz1234567", "badkey": True}
     assert not sensehat_listener.validStringPost(p)
Example #4
0
 def test_too_long_string_case(self):
     p = {"string": "abcdefghijklmnopqrstuvwxyz1234567"}
     assert not sensehat_listener.validStringPost(p)
Example #5
0
 def test_empty_case(self):
     p = {}
     assert not sensehat_listener.validStringPost(p)
Example #6
0
 def test_int_speed_case(self):
     p = {"string": "a", "speed": 1}
     assert sensehat_listener.validStringPost(p)
Example #7
0
 def test_minimal_case(self):
     p = {"string": "a"}
     assert sensehat_listener.validStringPost(p)