Python decouple.Csv() Examples
The following are 2
code examples of decouple.Csv().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
decouple
, or try the search function
.
Example #1
Source File: test_helper_csv.py From python-decouple with MIT License | 5 votes |
def test_csv(): csv = Csv() assert ['127.0.0.1', '.localhost', '.herokuapp.com'] == \ csv('127.0.0.1, .localhost, .herokuapp.com') csv = Csv(int) assert [1, 2, 3, 4, 5] == csv('1,2,3,4,5') csv = Csv(post_process=tuple) assert ('HTTP_X_FORWARDED_PROTO', 'https') == \ csv('HTTP_X_FORWARDED_PROTO, https') csv = Csv(cast=lambda s: s.upper(), delimiter='\t', strip=' %*') assert ['VIRTUAL_ENV', 'IMPORTANT STUFF', 'TRAILING SPACES'] == \ csv('%virtual_env%\t *important stuff*\t trailing spaces ')
Example #2
Source File: test_helper_csv.py From python-decouple with MIT License | 5 votes |
def test_csv_quoted_parse(): csv = Csv() assert ['foo', 'bar, baz', 'qux'] == csv(""" foo ,'bar, baz', 'qux'""") assert ['foo', 'bar, baz', 'qux'] == csv(''' foo ,"bar, baz", "qux"''') assert ['foo', "'bar, baz'", "'qux"] == csv(''' foo ,"'bar, baz'", "'qux"''') assert ['foo', '"bar, baz"', '"qux'] == csv(""" foo ,'"bar, baz"', '"qux'""")