Improved formatting
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
iCalendar parser test (ical_parser)
|
||||
@@ -14,45 +13,45 @@ from urllib.request import urlopen
|
||||
from inkycal.modules.ical_parser import iCalendar
|
||||
from helper_functions import *
|
||||
|
||||
|
||||
ical = iCalendar()
|
||||
test_ical = 'https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics'
|
||||
|
||||
|
||||
class ical_parser_test(unittest.TestCase):
|
||||
|
||||
def test_load_url(self):
|
||||
print('testing loading via URL...', end="")
|
||||
ical.load_url(test_ical)
|
||||
print('OK')
|
||||
def test_load_url(self):
|
||||
print('testing loading via URL...', end="")
|
||||
ical.load_url(test_ical)
|
||||
print('OK')
|
||||
|
||||
def test_get_events(self):
|
||||
print('testing parsing of events...', end="")
|
||||
ical.get_events(arrow.now(), arrow.now().shift(weeks=30))
|
||||
print('OK')
|
||||
def test_get_events(self):
|
||||
print('testing parsing of events...', end="")
|
||||
ical.get_events(arrow.now(), arrow.now().shift(weeks=30))
|
||||
print('OK')
|
||||
|
||||
def test_sorting(self):
|
||||
print('testing sorting of events...', end="")
|
||||
ical.sort()
|
||||
print('OK')
|
||||
def test_sorting(self):
|
||||
print('testing sorting of events...', end="")
|
||||
ical.sort()
|
||||
print('OK')
|
||||
|
||||
def test_show_events(self):
|
||||
print('testing if events can be shown...', end="")
|
||||
ical.show_events()
|
||||
print('OK')
|
||||
def test_show_events(self):
|
||||
print('testing if events can be shown...', end="")
|
||||
ical.show_events()
|
||||
print('OK')
|
||||
|
||||
def test_laod_from_file(self):
|
||||
print('testing loading from file...', end="")
|
||||
dummy = str(urlopen(test_ical).read().decode())
|
||||
with open('dummy.ical', mode="w") as file:
|
||||
file.write(dummy)
|
||||
ical.load_from_file('dummy.ical')
|
||||
print('OK')
|
||||
os.remove('dummy.ical')
|
||||
|
||||
def test_laod_from_file(self):
|
||||
print('testing loading from file...', end="")
|
||||
dummy = str(urlopen(test_ical).read().decode())
|
||||
with open('dummy.ical', mode="w") as file:
|
||||
file.write(dummy)
|
||||
ical.load_from_file('dummy.ical')
|
||||
print('OK')
|
||||
os.remove('dummy.ical')
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
Agenda test (inkycal_agenda)
|
||||
Copyright by aceisace
|
||||
@@ -7,80 +7,80 @@ Copyright by aceisace
|
||||
import unittest
|
||||
from inkycal.modules import Agenda as Module
|
||||
from helper_functions import *
|
||||
|
||||
environment = get_environment()
|
||||
|
||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||
use_preview = False
|
||||
|
||||
|
||||
sample_url = "https://www.officeholidays.com/ics-fed/usa"
|
||||
|
||||
tests = [
|
||||
{
|
||||
"name": "Agenda",
|
||||
"config": {
|
||||
"size": [400, 200],
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "ddd D MMM",
|
||||
"time_format": "HH:mm",
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Agenda",
|
||||
"config": {
|
||||
"size": [500, 800],
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "ddd D MMM",
|
||||
"time_format": "HH:mm",
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"position": 1,
|
||||
"name": "Agenda",
|
||||
"config": {
|
||||
"size": [300, 800],
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "ddd D MMM",
|
||||
"time_format": "HH:mm",
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Agenda",
|
||||
"config": {
|
||||
"size": [400, 200],
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "ddd D MMM",
|
||||
"time_format": "HH:mm",
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Agenda",
|
||||
"config": {
|
||||
"size": [500, 800],
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "ddd D MMM",
|
||||
"time_format": "HH:mm",
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"position": 1,
|
||||
"name": "Agenda",
|
||||
"config": {
|
||||
"size": [300, 800],
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "ddd D MMM",
|
||||
"time_format": "HH:mm",
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end = "")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end="")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test) + 1} generating image..')
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test)+1} generating image..')
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
Calendar test (inkycal_calendar)
|
||||
@@ -9,84 +8,85 @@ Copyright by aceisace
|
||||
import unittest
|
||||
from inkycal.modules import Calendar as Module
|
||||
from helper_functions import *
|
||||
|
||||
environment = get_environment()
|
||||
|
||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||
use_preview = False
|
||||
|
||||
|
||||
sample_url = "https://www.officeholidays.com/ics-fed/usa"
|
||||
|
||||
tests = [
|
||||
{
|
||||
"name": "Calendar",
|
||||
"config": {
|
||||
"size": [500, 500],
|
||||
"week_starts_on": "Monday",
|
||||
"show_events": True,
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "D MMM", "time_format": "HH:mm",
|
||||
"padding_x": 10,"padding_y": 10,"fontsize": 12,"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Calendar",
|
||||
"config": {
|
||||
"size": [400, 800],
|
||||
"week_starts_on": "Sunday",
|
||||
"show_events": True,
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "D MMM", "time_format": "HH:mm",
|
||||
"padding_x": 10,"padding_y": 10,"fontsize": 12,"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Calendar",
|
||||
"config": {
|
||||
"size": [400, 800],
|
||||
"week_starts_on": "Monday",
|
||||
"show_events": False,
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "D MMM", "time_format": "HH:mm",
|
||||
"padding_x": 10,"padding_y": 10,"fontsize": 12,"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Calendar",
|
||||
"config": {
|
||||
"size": [400, 800],
|
||||
"week_starts_on": "Monday",
|
||||
"show_events": True,
|
||||
"ical_urls": None,
|
||||
"ical_files": None,
|
||||
"date_format": "D MMM", "time_format": "HH:mm",
|
||||
"padding_x": 10,"padding_y": 10,"fontsize": 12,"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Calendar",
|
||||
"config": {
|
||||
"size": [500, 500],
|
||||
"week_starts_on": "Monday",
|
||||
"show_events": True,
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "D MMM", "time_format": "HH:mm",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Calendar",
|
||||
"config": {
|
||||
"size": [400, 800],
|
||||
"week_starts_on": "Sunday",
|
||||
"show_events": True,
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "D MMM", "time_format": "HH:mm",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Calendar",
|
||||
"config": {
|
||||
"size": [400, 800],
|
||||
"week_starts_on": "Monday",
|
||||
"show_events": False,
|
||||
"ical_urls": sample_url,
|
||||
"ical_files": None,
|
||||
"date_format": "D MMM", "time_format": "HH:mm",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Calendar",
|
||||
"config": {
|
||||
"size": [400, 800],
|
||||
"week_starts_on": "Monday",
|
||||
"show_events": True,
|
||||
"ical_urls": None,
|
||||
"ical_files": None,
|
||||
"date_format": "D MMM", "time_format": "HH:mm",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end = "")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test)+1} generating image..', end="")
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end="")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test) + 1} generating image..', end="")
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
Feeds test (inykcal_feeds)
|
||||
@@ -9,61 +8,62 @@ Copyright by aceisace
|
||||
import unittest
|
||||
from inkycal.modules import Feeds as Module
|
||||
from helper_functions import *
|
||||
|
||||
environment = get_environment()
|
||||
|
||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||
use_preview = False
|
||||
|
||||
tests = [
|
||||
{
|
||||
"name": "Feeds",
|
||||
"config": {
|
||||
"size": [400,200],
|
||||
"feed_urls": "http://feeds.bbci.co.uk/news/world/rss.xml#",
|
||||
"shuffle_feeds": True,
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Feeds",
|
||||
"config": {
|
||||
"size": [400,100],
|
||||
"feed_urls": "http://feeds.bbci.co.uk/news/world/rss.xml#",
|
||||
"shuffle_feeds": False,
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 14, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Feeds",
|
||||
"config": {
|
||||
"size": [400,100],
|
||||
"feed_urls": "https://www.anekdot.ru/rss/export_top.xml",
|
||||
"shuffle_feeds": False,
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Feeds",
|
||||
"config": {
|
||||
"size": [400, 200],
|
||||
"feed_urls": "http://feeds.bbci.co.uk/news/world/rss.xml#",
|
||||
"shuffle_feeds": True,
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Feeds",
|
||||
"config": {
|
||||
"size": [400, 100],
|
||||
"feed_urls": "http://feeds.bbci.co.uk/news/world/rss.xml#",
|
||||
"shuffle_feeds": False,
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 14, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Feeds",
|
||||
"config": {
|
||||
"size": [400, 100],
|
||||
"feed_urls": "https://www.anekdot.ru/rss/export_top.xml",
|
||||
"shuffle_feeds": False,
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end = "")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test)+1} generating image..')
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end="")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test) + 1} generating image..')
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
unittest.main()
|
||||
|
||||
unittest.main()
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
Image test (inkycal_image)
|
||||
@@ -10,113 +9,114 @@ import unittest
|
||||
from inkycal.modules import Inkyimage as Module
|
||||
from inkycal.custom import top_level
|
||||
from helper_functions import *
|
||||
|
||||
environment = get_environment()
|
||||
|
||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||
use_preview = False
|
||||
|
||||
|
||||
test_path = f'{top_level}/Gallery/coffee.png'
|
||||
|
||||
tests = [
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [400,200],
|
||||
"path": test_path,
|
||||
"palette": "bwr",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [800,500],
|
||||
"path": test_path,
|
||||
"palette": "bwy",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [400,100],
|
||||
"path": test_path,
|
||||
"palette": "bw",
|
||||
"autoflip": False,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [400,100],
|
||||
"path": test_path,
|
||||
"palette": "bwr",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [400,100],
|
||||
"path": test_path,
|
||||
"palette": "bwy",
|
||||
"autoflip": True,
|
||||
"orientation": "horizontal",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [500, 800],
|
||||
"path": test_path,
|
||||
"palette": "bw",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 0, "padding_y": 0, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [500, 800],
|
||||
"path": test_path,
|
||||
"palette": "bwr",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 20, "padding_y": 20, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [400, 200],
|
||||
"path": test_path,
|
||||
"palette": "bwr",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [800, 500],
|
||||
"path": test_path,
|
||||
"palette": "bwy",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [400, 100],
|
||||
"path": test_path,
|
||||
"palette": "bw",
|
||||
"autoflip": False,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [400, 100],
|
||||
"path": test_path,
|
||||
"palette": "bwr",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [400, 100],
|
||||
"path": test_path,
|
||||
"palette": "bwy",
|
||||
"autoflip": True,
|
||||
"orientation": "horizontal",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [500, 800],
|
||||
"path": test_path,
|
||||
"palette": "bw",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 0, "padding_y": 0, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Inkyimage",
|
||||
"config": {
|
||||
"size": [500, 800],
|
||||
"path": test_path,
|
||||
"palette": "bwr",
|
||||
"autoflip": True,
|
||||
"orientation": "vertical",
|
||||
"padding_x": 20, "padding_y": 20, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end = "")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test)+1} generating image..')
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end="")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test) + 1} generating image..')
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
Jokes test (inkycal_jokes)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
Slideshow test (inkycal_slideshow)
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
Stocks test (inkycal_stocks)
|
||||
@@ -9,82 +8,83 @@ Copyright by aceisace
|
||||
import unittest
|
||||
from inkycal.modules import Stocks as Module
|
||||
from helper_functions import *
|
||||
|
||||
environment = get_environment()
|
||||
|
||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||
use_preview = False
|
||||
|
||||
|
||||
tests = [
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 30],
|
||||
"tickers": ['TSLA', 'AMD', 'NVDA', '^DJI', 'BTC-USD', 'EURUSD=X'],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 50],
|
||||
"tickers": [],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 200],
|
||||
"tickers": ['TSLA', 'AMD', 'NVDA', '^DJI', 'BTC-USD', 'EURUSD=X'],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 800],
|
||||
"tickers": ['TSLA', 'AMD', 'NVDA', '^DJI', 'BTC-USD', 'EURUSD=X'],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 100],
|
||||
"tickers": "TSLA,AMD,NVDA,^DJI,BTC-USD,EURUSD=X",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 400],
|
||||
"tickers": ['TSLA', 'AMD', 'NVDA', '^DJI', 'BTC-USD', 'EURUSD=X'],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 14, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 30],
|
||||
"tickers": ['TSLA', 'AMD', 'NVDA', '^DJI', 'BTC-USD', 'EURUSD=X'],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 50],
|
||||
"tickers": [],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 200],
|
||||
"tickers": ['TSLA', 'AMD', 'NVDA', '^DJI', 'BTC-USD', 'EURUSD=X'],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 800],
|
||||
"tickers": ['TSLA', 'AMD', 'NVDA', '^DJI', 'BTC-USD', 'EURUSD=X'],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 100],
|
||||
"tickers": "TSLA,AMD,NVDA,^DJI,BTC-USD,EURUSD=X",
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 12, "language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Stocks",
|
||||
"config": {
|
||||
"size": [528, 400],
|
||||
"tickers": ['TSLA', 'AMD', 'NVDA', '^DJI', 'BTC-USD', 'EURUSD=X'],
|
||||
"padding_x": 10, "padding_y": 10, "fontsize": 14, "language": "en"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end = "")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test)+1} generating image..')
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end="")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test) + 1} generating image..')
|
||||
module = Module(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if use_preview == True and environment == 'Raspberry':
|
||||
preview(merge(im_black, im_colour))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.level = logging.DEBUG
|
||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
|
@@ -1,2 +0,0 @@
|
||||
import unittest
|
||||
from inkycal.modules import Todoist as Module
|
@@ -1,3 +1,5 @@
|
||||
#!python3
|
||||
|
||||
import unittest
|
||||
from inkycal.modules import Todoist as Module
|
||||
from helper_functions import *
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#!python3
|
||||
|
||||
import unittest
|
||||
from inkycal.modules import Weather as Module
|
||||
from helper_functions import *
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#!python3
|
||||
|
||||
"""
|
||||
Main test (main)
|
||||
|
Reference in New Issue
Block a user