Skip to content

Commit eb50590

Browse files
committed
Add test for interpolation when dollar sign is in the string
1 parent 3531576 commit eb50590

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

tests/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def generate_data(cls):
6565
BOOL_FALSE_STRING_LIKE_BOOL='False',
6666
BOOL_FALSE_BOOL=False,
6767
PROXIED_VAR='$STR_VAR',
68-
DOLLAR_VAR='SOME_VALUE$S3CR3TK3Y@HELLO',
68+
DOLLAR_VAR_1='SOME_VALUE$S3CR3TK3Y@HELLO',
6969
ESCAPED_VAR=r'\$baz',
7070
INT_LIST='42,33',
7171
INT_TUPLE='(42,33)',

tests/test_env.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ def test_not_interpolated_proxied_value(self):
191191
assert env('PROXIED_VAR') == '$STR_VAR'
192192

193193
def test_dollar_sign(self):
194-
assert self.env('DOLLAR_VAR') == 'SOME_VALUE$S3CR3TK3Y@HELLO'
194+
assert self.env('DOLLAR_VAR_1') == 'SOME_VALUE$S3CR3TK3Y@HELLO'
195+
196+
def test_dollar_sign_not_interpolated(self):
197+
env = Env(interpolate=False)
198+
assert env('DOLLAR_VAR_1') == 'SOME_VALUE$S3CR3TK3Y@HELLO'
195199

196200
def test_escaped_dollar_sign(self):
197201
self.env.escape_proxy = True

tests/test_env.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ FLOAT_STRANGE_VAR1=123,420,333.3
3838
FLOAT_STRANGE_VAR2=123.420.333,3
3939
FLOAT_NEGATIVE_VAR=-1.0
4040
PROXIED_VAR=$STR_VAR
41-
DOLLAR_VAR=SOME_VALUE$S3CR3TK3Y@HELLO
41+
DOLLAR_VAR_1=SOME_VALUE$S3CR3TK3Y@HELLO
42+
DOLLAR_VAR_2='SOME_VALUE$S3CR3TK3Y@HELLO'
43+
DOLLAR_VAR_3="SOME_VALUE$S3CR3TK3Y@HELLO"
4244
ESCAPED_VAR=\$baz
4345
EMPTY_LIST=
4446
EMPTY_INT_VAR=

0 commit comments

Comments
 (0)