35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
# sotfsavetool (c) by chacha
|
|
#
|
|
# sotfsavetool is licensed under a
|
|
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Unported License.
|
|
#
|
|
# You should have received a copy of the license along with this
|
|
# work. If not, see <https://creativecommons.org/licenses/by-nc-sa/4.0/>.
|
|
|
|
import unittest
|
|
from os import chdir
|
|
from io import StringIO
|
|
from contextlib import redirect_stdout,redirect_stderr
|
|
from pathlib import Path
|
|
|
|
print(__name__)
|
|
print(__package__)
|
|
|
|
from src import sotfsavetool
|
|
|
|
testdir_path = Path(__file__).parent.resolve()
|
|
chdir(testdir_path.parent.resolve())
|
|
|
|
class Testtest_module(unittest.TestCase):
|
|
def setUp(self) -> None:
|
|
chdir(testdir_path.parent.resolve())
|
|
|
|
def test_version(self):
|
|
self.assertNotEqual(sotfsavetool.__version__,"?.?.?")
|
|
|
|
def test_test_module(self):
|
|
|
|
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
|
|
self.assertEqual(sotfsavetool.test_function(41),42)
|
|
self.assertEqual(len(capted_stderr.getvalue()),0)
|
|
self.assertEqual(capted_stdout.getvalue().strip(),"Hello world !") |