for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import os
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
class SomeClass: def some_method(self): """Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.
import textwrap
import unittest
from tempfile import NamedTemporaryFile
from foil.dotenv import read_dotenv
def mock_dotenv():
return textwrap.dedent("""\
SECRET=quiet
# comment this
forgot equals
DB='drawer'""")
class TestDotEnv(unittest.TestCase):
@classmethod
def setUpClass(cls):
with NamedTemporaryFile(suffix='.env', delete=False) as tmp:
with open(tmp.name, 'w', encoding='UTF-8') as file:
file.write(mock_dotenv())
cls.path = tmp.name
def test_read_dotenv(self):
expected = [('SECRET', 'quiet'), ('DB', 'drawer')]
result = list(read_dotenv(self.path))
self.assertEqual(expected, result)
def tearDown(cls):
if os.path.exists(cls.path):
os.unlink(cls.path)
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.