# Path: segno/cli.py
# _EXT_TO_KW_MAPPING = {}
# def _get_args(func):
# def make_parser():
#     def _convert_scale(val):
# def parse(args):
# def build_config(config, filename=None):
# def make_code(config):
# def main(args=sys.argv[1:]):
#     def __init__(self, *args, **kwargs):
# class _AttrDict(dict):


import os
import io
import tempfile
import pytest
import segno
from segno import cli
# License: BSD License
#
"""\
Tests against issue 39
<https://github.com/heuer/segno/issues/39>
"""
from __future__ import absolute_import, unicode_literals


def test_output():
    out = io.BytesIO()
    segno.make_qr('Good Times', error='M').save(out, kind='png', scale=10,
                                                dark='red')
    f = tempfile.NamedTemporaryFile('w', suffix='.png', delete=False)
    f.close()
    cli.main(['-e=M', '--scale=10', '--dark=red', '--output={0}'.format(f.name),
              'Good Times'])
    f = open(f.name, 'rb')
    content = f.read()
    f.close()
    os.unlink(f.name)
    assert out.getvalue() == content


def test_output2():
    out = io.BytesIO()
    segno.make_qr('Good Times', error='M').save(out, kind='png', scale=10,
                                                dark='red')
    f = tempfile.NamedTemporaryFile('w', suffix='.png', delete=False)
    f.close()

# Path: segno/cli.py
# _EXT_TO_KW_MAPPING = {}
# def _get_args(func):
# def make_parser():
#     def _convert_scale(val):
# def parse(args):
# def build_config(config, filename=None):
# def make_code(config):
# def main(args=sys.argv[1:]):
#     def __init__(self, *args, **kwargs):
# class _AttrDict(dict):


# Path: tests/test_issue39_unquoted.py
import os
import io
import tempfile
import pytest
import segno
from segno import cli

# License: BSD License
#
"""\
Tests against issue 39
<https://github.com/heuer/segno/issues/39>
"""
from __future__ import absolute_import, unicode_literals


def test_output():
    out = io.BytesIO()
    segno.make_qr('Good Times', error='M').save(out, kind='png', scale=10,
                                                dark='red')
    f = tempfile.NamedTemporaryFile('w', suffix='.png', delete=False)
    f.close()
    cli.main(['-e=M', '--scale=10', '--dark=red', '--output={0}'.format(f.name),
              'Good Times'])
    f = open(f.name, 'rb')
    content = f.read()
    f.close()
    os.unlink(f.name)
    assert out.getvalue() == content


def test_output2():
    out = io.BytesIO()
    segno.make_qr('Good Times', error='M').save(out, kind='png', scale=10,
                                                dark='red')
    f = tempfile.NamedTemporaryFile('w', suffix='.png', delete=False)
    f.close()

    cli.main(['-e=M', '--scale=10', '--dark=red', '--output={0}'.format(f.name),