[core] fix tests

This commit is contained in:
tobi-wan-kenobi 2020-05-08 21:01:45 +02:00
parent dd4294ecfa
commit 9ef826b5fd
3 changed files with 5 additions and 5 deletions

View file

@ -74,7 +74,7 @@ class config(unittest.TestCase):
with unittest.mock.patch("core.config.sys") as sys: with unittest.mock.patch("core.config.sys") as sys:
cfg = core.config.Config(["-l", "themes"]) cfg = core.config.Config(["-l", "themes"])
cfg = core.config.Config(["-l", "modules"]) cfg = core.config.Config(["-l", "modules"])
cfg = core.config.Config(["-l", "modules-markdown"]) cfg = core.config.Config(["-l", "modules-rst"])
# TODO: think of some plausibility testing here # TODO: think of some plausibility testing here
def test_missing_parameter(self): def test_missing_parameter(self):

View file

@ -1,18 +1,18 @@
import unittest import unittest
import core.config import core.config
import modules.core.kernel import modules.contrib.kernel
class kernel(unittest.TestCase): class kernel(unittest.TestCase):
def setUp(self): def setUp(self):
self.someKernel = "this-is-my-kernel" self.someKernel = "this-is-my-kernel"
self.module = modules.core.kernel.Module( self.module = modules.contrib.kernel.Module(
config=core.config.Config([]), theme=None config=core.config.Config([]), theme=None
) )
def test_full_text(self): def test_full_text(self):
with unittest.mock.patch("modules.core.kernel.platform") as platform: with unittest.mock.patch("modules.contrib.kernel.platform") as platform:
platform.release.return_value = self.someKernel platform.release.return_value = self.someKernel
self.assertEqual(1, len(self.module.widgets())) self.assertEqual(1, len(self.module.widgets()))
self.assertEqual(self.someKernel, self.module.widget().full_text()) self.assertEqual(self.someKernel, self.module.widget().full_text())

View file

@ -66,7 +66,7 @@ def astemperature(val, unit="metric"):
:return: temperature representation of the input value :return: temperature representation of the input value
:rtype: string :rtype: string
""" """
return "{}°{}".format(int(value), __UNITS.get(unit, __UNITS["default"])) return "{}°{}".format(int(val), __UNITS.get(unit, __UNITS["default"]))
def byte(val, fmt="{:.2f}"): def byte(val, fmt="{:.2f}"):