Skip to content

Instantly share code, notes, and snippets.

@exhuma
Created December 24, 2017 08:41
Show Gist options
  • Save exhuma/0728d2feb38aff0e4bd00ebd94440ca5 to your computer and use it in GitHub Desktop.
Save exhuma/0728d2feb38aff0e4bd00ebd94440ca5 to your computer and use it in GitHub Desktop.
Using dedent to keep multi-line-strings on same indent-level as the rest
class TestFrontendHelpers(TestCase):
SQLALCHEMY_DATABASE_URI = 'postgresql://exhuma@/powonline_testing'
SQLALCHEMY_TRACK_MODIFICATIONS = False
TESTING = True
def __create_app(self):
config = ConfigParser()
config.read_string(dedent(
'''\
[db]
dsn = %s
[security]
jwt_secret = %s
''' % (
TestFrontendHelpers.SQLALCHEMY_DATABASE_URI,
'testing'
)))
return make_app(config)
"""
The same without dedent
"""
class TestFrontendHelpers(TestCase):
SQLALCHEMY_DATABASE_URI = 'postgresql://exhuma@/powonline_testing'
SQLALCHEMY_TRACK_MODIFICATIONS = False
TESTING = True
def __create_app(self):
config = ConfigParser()
config.read_string(
'''
[db]
dsn = %s
[security]
jwt_secret = %s
''' % (
TestFrontendHelpers.SQLALCHEMY_DATABASE_URI,
'testing'
))
return make_app(config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment