first source commit

This commit is contained in:
cclecle
2023-03-21 01:08:47 +00:00
parent cba7e0ebf6
commit 0fe9f4fb96
7 changed files with 215 additions and 77 deletions

View File

@@ -0,0 +1,68 @@
# pychangelogfactory (c) by chacha
#
# pychangelogfactory 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 io import StringIO
from contextlib import redirect_stdout,redirect_stderr
print(__name__)
print(__package__)
from src import pychangelogfactory
test_commitlog_1="""
breaking: test1
feat: test2
chore: test3
security: test4
style:test5
fix: test6
wip: test7
perf: test8
refactor: test9
ci: test10
docs: test11
test: test12
build: test13
- fix: test14
revert: test15
toto:un autre cas
fdsfdsfdsfsdfsdff
"""
class Testtest_module(unittest.TestCase):
def test_simplegeneration_full(self):
pychangelogfactory.ChangeLogFormater.FactoryProcessFullChangelog(test_commitlog_1)
changelog = pychangelogfactory.ChangeLogFormater.RenderFullChangelog()
print(changelog)
self.assertIn("test1",changelog)
self.assertIn("test2",changelog)
self.assertIn("test3",changelog)
self.assertIn("test4",changelog)
self.assertIn("test5",changelog)
self.assertIn("test6",changelog)
self.assertIn("test7",changelog)
self.assertIn("test8",changelog)
self.assertIn("test9",changelog)
self.assertIn("test10",changelog)
self.assertIn("test11",changelog)
self.assertIn("test12",changelog)
self.assertIn("test13",changelog)
self.assertIn("test14",changelog)
self.assertIn("test15",changelog)
self.assertIn("un autre cas",changelog)
self.assertIn("fdsfdsfdsfsdfsdff",changelog)

View File

@@ -1,32 +0,0 @@
# pychangelogfactory (c) by chacha
#
# pychangelogfactory 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 io import StringIO
from contextlib import redirect_stdout,redirect_stderr
print(__name__)
print(__package__)
from src import pychangelogfactory
class Testtest_module(unittest.TestCase):
def test_version(self):
self.assertNotEqual(pychangelogfactory.__version__,"?.?.?")
def test_test_module(self):
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
self.assertEqual(pychangelogfactory.test_function(41),42)
self.assertEqual(len(capted_stderr.getvalue()),0)
self.assertEqual(capted_stdout.getvalue().strip(),"Hello world !")
self.assertEqual(len(capted_stderr.getvalue()),0)