示例#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'])
示例#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'])
示例#3
0
 def test_returns_flattened_list(self):
     data = ['foo', ['bar', ('baz', 42)]]
     assert_equal(db.json_get_values(data), ['foo', 'bar', 'baz', '42'])
示例#4
0
 def test_returns_empty_list_if_called_with_none(self):
     assert_equal(db.json_get_values(None), [])
示例#5
0
 def test_returns_list_with_value_if_called_with_string(self):
     assert_equal(db.json_get_values('foo'), ['foo'])
示例#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'])
示例#7
0
 def test_returns_flattened_list(self):
     data = ['foo', ['bar', ('baz', 42)]]
     assert_equal(db.json_get_values(data), ['foo', 'bar', 'baz', '42'])
示例#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'])
示例#9
0
 def test_returns_list_with_value_if_called_with_string(self):
     assert_equal(db.json_get_values('foo'), ['foo'])
示例#10
0
 def test_returns_empty_list_if_called_with_none(self):
     assert_equal(db.json_get_values(None), [])