File size: 556 Bytes
065fee7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from io import StringIO
from unittest import TestCase
from pymysql.optionfile import Parser
__all__ = ["TestParser"]
_cfg_file = r"""
[default]
string = foo
quoted = "bar"
single_quoted = 'foobar'
skip-slave-start
"""
class TestParser(TestCase):
def test_string(self):
parser = Parser()
parser.read_file(StringIO(_cfg_file))
self.assertEqual(parser.get("default", "string"), "foo")
self.assertEqual(parser.get("default", "quoted"), "bar")
self.assertEqual(parser.get("default", "single-quoted"), "foobar")
|