Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion decouple.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self, source, encoding=DEFAULT_ENCODING):
k = k.strip()
v = v.strip()
if len(v) >= 2 and ((v[0] == "'" and v[-1] == "'") or (v[0] == '"' and v[-1] == '"')):
v = v.strip('\'"')
v = v[1:-1]
self.data[k] = v

def __contains__(self, key):
Expand Down
4 changes: 4 additions & 0 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
KeyWithDoubleQuoteBegin="text
KeyIsSingleQuote='
KeyIsDoubleQuote="
KeyHasTwoSingleQuote="'Y'"
KeyHasTwoDoubleQuote='"Y"'
'''

@pytest.fixture(scope='module')
Expand Down Expand Up @@ -128,3 +130,5 @@ def test_env_with_quote(config):
assert '"text' == config('KeyWithDoubleQuoteBegin')
assert '"' == config('KeyIsDoubleQuote')
assert "'" == config('KeyIsSingleQuote')
assert "'Y'" == config('KeyHasTwoSingleQuote')
assert '"Y"' == config('KeyHasTwoDoubleQuote')