|
8 | 8 | import sh |
9 | 9 |
|
10 | 10 | from dotenv import load_dotenv, find_dotenv, set_key, dotenv_values |
| 11 | +from dotenv.main import parse_line |
11 | 12 | from dotenv.compat import StringIO |
12 | 13 | from IPython.terminal.embed import InteractiveShellEmbed |
13 | 14 |
|
14 | 15 |
|
| 16 | +@pytest.mark.parametrize("test_input,expected", [ |
| 17 | + ("a=b", ("a", "b")), |
| 18 | + (" a = b ", ("a", "b")), |
| 19 | + ("export a=b", ("a", "b")), |
| 20 | + (" export 'a'=b", ("'a'", "b")), |
| 21 | + (" export 'a'=b", ("'a'", "b")), |
| 22 | + ("# a=b", (None, None)), |
| 23 | + ("# a=b", (None, None)), |
| 24 | + ("a=b space ", ('a', 'b space')), |
| 25 | + ("a='b space '", ('a', 'b space ')), |
| 26 | + ('a="b space "', ('a', 'b space ')), |
| 27 | +]) |
| 28 | +def test_parse_line(test_input, expected): |
| 29 | + assert parse_line(test_input) == expected |
| 30 | + |
| 31 | + |
15 | 32 | def test_warns_if_file_does_not_exist(): |
16 | 33 | with warnings.catch_warnings(record=True) as w: |
17 | 34 | load_dotenv('.does_not_exist', verbose=True) |
|
0 commit comments