def test_non_existing_key_case_insensitive(self): props = {b'C#': b'259', b'heLLo': b'World'} val = get_from_properties(props, b'c#') self.assertEqual(None, val) val = get_from_properties(props, b'c#', case_sensitive=True) self.assertEqual(None, val) val = get_from_properties(props, b'c#', case_sensitive=False) self.assertEqual('259', val) val = get_from_properties(props, b'HEllo', case_sensitive=False) self.assertEqual('World', val)
def test_non_existing_key_with_default_non_string(self): props = {b'c#': b'259'} val = get_from_properties(props, b's#', default=1) self.assertEqual('1', val)
def test_existing_key(self): props = {b'c#': b'259'} val = get_from_properties(props, b'c#') self.assertEqual('259', val)
def test_non_existing_key_no_default(self): props = {b'c#': b'259'} val = get_from_properties(props, b's#') self.assertEqual(None, val)
def test_non_existing_key_with_default(self): props = {'c#': '259'} val = get_from_properties(props, 's#', default='1') self.assertEqual('1', val)