mirror of
https://github.com/ejeanboris/MDAF.git
synced 2025-06-16 10:08:30 +00:00
debug
This commit is contained in:
Binary file not shown.
BIN
tests/__pycache__/test_funcs.cpython-39-pytest-6.2.4.pyc
Normal file
BIN
tests/__pycache__/test_funcs.cpython-39-pytest-6.2.4.pyc
Normal file
Binary file not shown.
BIN
tests/__pycache__/test_unit.cpython-39-pytest-6.2.4.pyc
Normal file
BIN
tests/__pycache__/test_unit.cpython-39-pytest-6.2.4.pyc
Normal file
Binary file not shown.
21
tests/deprecated_funcs.py
Normal file
21
tests/deprecated_funcs.py
Normal file
@ -0,0 +1,21 @@
|
||||
import unittest
|
||||
import os
|
||||
import importlib.util as utl
|
||||
|
||||
from MDAF.TestFunctions import *
|
||||
import doctest
|
||||
|
||||
|
||||
# Testing the test function representation workflow
|
||||
def load_tests(loader, tests, ignore):
|
||||
fullpath = 'MDAF/TestFunctions'
|
||||
for func in os.scandir(fullpath):
|
||||
name = str(func.name)
|
||||
if(name.find('.py') and name.find('.old') == -1 and func.is_file() and name.find('__init__.py')==-1):
|
||||
spec = utl.spec_from_file_location(name[-3], fullpath+'/'+name)
|
||||
funcmodule = utl.module_from_spec(spec)
|
||||
spec.loader.exec_module(funcmodule)
|
||||
|
||||
tests.addTests(doctest.DocTestSuite(funcmodule))
|
||||
return tests
|
||||
|
53
tests/deprecated_unit.py
Normal file
53
tests/deprecated_unit.py
Normal file
@ -0,0 +1,53 @@
|
||||
import unittest
|
||||
import doctest
|
||||
import os
|
||||
|
||||
def load_tests(loader, tests, ignore):
|
||||
fullpath = 'MDAF/TestFunctions'
|
||||
testlist = []
|
||||
for func in os.scandir(fullpath):
|
||||
name = str(func.name)
|
||||
if(name.find('.py') and name.find('.old') == -1 and func.is_file()):
|
||||
spec = importlib.util.spec_from_file_location(name, fullpath)
|
||||
funcmodule = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(funcmodule)
|
||||
|
||||
tests.addTests(doctest.DocTestSuite(funcmodule))
|
||||
return tests
|
||||
|
||||
if __name__ == '__main__':
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(load_tests())
|
||||
|
||||
|
||||
|
||||
|
||||
import unittest
|
||||
import os
|
||||
|
||||
|
||||
from MDAF.TestFunctions import *
|
||||
import doctest
|
||||
|
||||
|
||||
#target = __import__("MDAF.py")
|
||||
|
||||
# Testing the test function representation workflow
|
||||
def load_tests(loader, tests, ignore):
|
||||
|
||||
fullpath = 'MDAF/TestFunctions'
|
||||
testlist = []
|
||||
for func in os.scandir(fullpath):
|
||||
name = str(func.name)
|
||||
if(name.find('.py') and name.find('.old') == -1 and func.is_file()):
|
||||
curtest = doctest.DocTestSuite(os.path.relpath('../'+func.path[:-3]+'.main.__module__'))
|
||||
testlist.append(curtest)
|
||||
tests.addTests(testlist)
|
||||
|
||||
tests.addTests(doctest.DocTestSuite(Ackley2.main.__module__))
|
||||
for t in tests: return t
|
||||
|
||||
# run the suite
|
||||
suite = load_tests(loader, tests, ignore)
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(suite)
|
@ -4,6 +4,7 @@ import os
|
||||
from MDAF.MDAF import representfunc
|
||||
from MDAF.MDAF import installFalcoo
|
||||
from MDAF.MDAF import doe
|
||||
from MDAF.TestFunctions import *
|
||||
|
||||
#target = __import__("MDAF.py")
|
||||
|
||||
@ -32,11 +33,12 @@ class Test_representfunc(unittest.TestCase):
|
||||
Test that the function can calculate the representation and write to the function docstring
|
||||
"""
|
||||
funcpath = '@Bukin2.py'
|
||||
funcverify = 'MDAF/TestFunctions/Bukin2.py'
|
||||
#funcpath_backup = 'tests/Bukin2.py.old'
|
||||
|
||||
results = representfunc(funcpath, forced = True)
|
||||
|
||||
with open(funcpath,"r") as file:
|
||||
with open(funcverify,"r") as file:
|
||||
content = file.read()
|
||||
reprCheck = bool(content.find('#_# Represented: 1'))
|
||||
|
||||
|
Reference in New Issue
Block a user