# Path: pym2149/main.py
# def main_lc2txt(args = sys.argv[1:]):
#     'Render a Lurlene song to logging.'
#     from . import txt
#     initlogging()
#     config, di = boot(ConfigName('inpath', '--section', name = 'txt', args = args))
#     with di:
#         di.add(loadcontext)
#         di.add(LurleneBridge)
#         txt.configure(di)
#         di.add(SimpleChipTimer)
#         di.add(LogicalBundle)
#         di.add(Player)
#         di.all(Started)
#         di(MainThread).sleep()
# 
# def main_lc2wav(args = sys.argv[1:]):
#     'Render a Lurlene song to WAV.'
#     from . import out
#     initlogging()
#     config, di = boot(ConfigName('inpath', '--section', 'outpath', args = args))
#     with di:
#         di.add(loadcontext)
#         di.add(LurleneBridge)
#         out.configure(di)
#         di.add(ChipTimer)
#         di.add(LogicalBundle)
#         di.add(Player)
#         di.all(Started)
#         di(MainThread).sleep()
# 
# Path: pym2149/power.py
# def batterypower():
#     try:
#         from lagoon import upower
#     except ImportError:
#         return # Run all tests.
#     def states():
#         for line in upower.__show_info('/org/freedesktop/UPower/devices/battery_C173').splitlines():
#             words = wordpattern.findall(line)
#             if 2 == len(words) and 'state:' == words[0]:
#                 yield words[1]
#     states = list(states())
#     if states:
#         state, = states
#         return statetobatterypower[state]


from .main import main_lc2txt, main_lc2wav
from .power import batterypower
from base64 import a85encode
from lagoon import sox
from lurlene.util import threadlocals
from pathlib import Path
from PIL import Image, ImageChops
from tempfile import NamedTemporaryFile
from unittest import TestCase
# Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki

# This file is part of pym2149.
#
# pym2149 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pym2149 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pym2149.  If not, see <http://www.gnu.org/licenses/>.


project = Path(__file__).parent.parent
expecteddir = project / 'expected'
actualdir = project / 'actual'
pngsuffix = '.png'

def test_expected():

# Path: pym2149/main.py
# def main_lc2txt(args = sys.argv[1:]):
#     'Render a Lurlene song to logging.'
#     from . import txt
#     initlogging()
#     config, di = boot(ConfigName('inpath', '--section', name = 'txt', args = args))
#     with di:
#         di.add(loadcontext)
#         di.add(LurleneBridge)
#         txt.configure(di)
#         di.add(SimpleChipTimer)
#         di.add(LogicalBundle)
#         di.add(Player)
#         di.all(Started)
#         di(MainThread).sleep()
# 
# def main_lc2wav(args = sys.argv[1:]):
#     'Render a Lurlene song to WAV.'
#     from . import out
#     initlogging()
#     config, di = boot(ConfigName('inpath', '--section', 'outpath', args = args))
#     with di:
#         di.add(loadcontext)
#         di.add(LurleneBridge)
#         out.configure(di)
#         di.add(ChipTimer)
#         di.add(LogicalBundle)
#         di.add(Player)
#         di.all(Started)
#         di(MainThread).sleep()
# 
# Path: pym2149/power.py
# def batterypower():
#     try:
#         from lagoon import upower
#     except ImportError:
#         return # Run all tests.
#     def states():
#         for line in upower.__show_info('/org/freedesktop/UPower/devices/battery_C173').splitlines():
#             words = wordpattern.findall(line)
#             if 2 == len(words) and 'state:' == words[0]:
#                 yield words[1]
#     states = list(states())
#     if states:
#         state, = states
#         return statetobatterypower[state]


# Path: pym2149/test_expected.py
from .main import main_lc2txt, main_lc2wav
from .power import batterypower
from base64 import a85encode
from lagoon import sox
from lurlene.util import threadlocals
from pathlib import Path
from PIL import Image, ImageChops
from tempfile import NamedTemporaryFile
from unittest import TestCase

# Copyright 2014, 2018, 2019, 2020 Andrzej Cichocki

# This file is part of pym2149.
#
# pym2149 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pym2149 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pym2149.  If not, see <http://www.gnu.org/licenses/>.


project = Path(__file__).parent.parent
expecteddir = project / 'expected'
actualdir = project / 'actual'
pngsuffix = '.png'

def test_expected():

    if batterypower():