Exemplo n.º 1
0
 def test_returns_only_truthy_values_from_dict(self):
     data = {'foo': 'bar', 'baz': [42, None, {}, [], 'hey']}
     assert_equal(db.json_get_values(data),
                  ['foo', 'bar', 'baz', '42', 'hey'])
Exemplo n.º 2
0
 def test_returns_list_with_only_the_original_truthy_values_if_called(self):
     data = [None, 'foo', 42, 'bar', {}, []]
     assert_equal(db.json_get_values(data), ['foo', '42', 'bar'])
Exemplo n.º 3
0
 def test_returns_flattened_list(self):
     data = ['foo', ['bar', ('baz', 42)]]
     assert_equal(db.json_get_values(data), ['foo', 'bar', 'baz', '42'])
Exemplo n.º 4
0
 def test_returns_empty_list_if_called_with_none(self):
     assert_equal(db.json_get_values(None), [])
Exemplo n.º 5
0
 def test_returns_list_with_value_if_called_with_string(self):
     assert_equal(db.json_get_values('foo'), ['foo'])
Exemplo n.º 6
0
 def test_returns_only_truthy_values_from_dict(self):
     data = {'foo': 'bar', 'baz': [42, None, {}, [], 'hey']}
     assert_equal(db.json_get_values(data), ['foo', 'bar', 'baz', '42', 'hey'])
Exemplo n.º 7
0
 def test_returns_flattened_list(self):
     data = ['foo', ['bar', ('baz', 42)]]
     assert_equal(db.json_get_values(data), ['foo', 'bar', 'baz', '42'])
Exemplo n.º 8
0
 def test_returns_list_with_only_the_original_truthy_values_if_called(self):
     data = [None, 'foo', 42, 'bar', {}, []]
     assert_equal(db.json_get_values(data), ['foo', '42', 'bar'])
Exemplo n.º 9
0
 def test_returns_list_with_value_if_called_with_string(self):
     assert_equal(db.json_get_values('foo'), ['foo'])
Exemplo n.º 10
0
 def test_returns_empty_list_if_called_with_none(self):
     assert_equal(db.json_get_values(None), [])