Ulrich
2 years ago
16 changed files with 407 additions and 99 deletions
@ -0,0 +1,11 @@ |
|||
import basic.constants as B |
|||
SYNC_FULL_GIT2DB = "full-git-db" |
|||
SYNC_HEAD_GIT2DB = "head-git-db" |
|||
SYNC_COPY_FILE2DB = "copy-file-db" |
|||
SYNC_ONLY_GIT = "only-git" |
|||
SYNC_ONLY_DB = "only-db" |
|||
|
|||
STORAGE_DB = B.TOPIC_NODE_DB |
|||
STORAGE_FILE = B.TOPIC_NODE_FILE |
|||
|
|||
LIST_ENTITY_SYNC = [SYNC_ONLY_GIT, SYNC_FULL_GIT2DB, SYNC_HEAD_GIT2DB, SYNC_COPY_FILE2DB, SYNC_ONLY_DB] |
@ -0,0 +1,53 @@ |
|||
import unittest |
|||
import inspect |
|||
import basic.constants as B |
|||
import basic.toolHandling as toolHandling |
|||
import tools.data_const as D |
|||
import test.testtools |
|||
import test.constants |
|||
import basic.program |
|||
import os |
|||
|
|||
import tools.data_tool |
|||
|
|||
HOME_PATH = test.constants.HOME_PATH |
|||
DATA_PATH = test.constants.DATA_PATH |
|||
OS_SYSTEM = test.constants.OS_SYSTEM |
|||
""" |
|||
a) catalog: key(s) - values # meta-spec, meta-auto |
|||
b) head: key - value # spec-info |
|||
c) option: key - value # spec -> job.par |
|||
d) step: key=function - values # spec (tp, ts) -> comp.function |
|||
e) step: key=usecase - values # spec (tc) -> comp.steps |
|||
f) ddl-table: key=field - vaulues=attributes # meta-spec, comp |
|||
g) data-table: array: field - values # spec.data, comp.artifacts |
|||
""" |
|||
|
|||
# the list of TEST_FUNCTIONS defines which function will be really tested. |
|||
# if you minimize the list you can check the specific test-function |
|||
TEST_FUNCTIONS = ["test_01getKeyword"] |
|||
PROGRAM_NAME = "clean_workspace" |
|||
|
|||
# with this variable you can switch prints on and off |
|||
verbose = False |
|||
|
|||
class MyTestCase(unittest.TestCase): |
|||
mymsg = "--------------------------------------------------------------" |
|||
|
|||
def test_01getKeyword(self): |
|||
global mymsg |
|||
actfunction = str(inspect.currentframe().f_code.co_name) |
|||
cnttest = 0 |
|||
if actfunction not in TEST_FUNCTIONS: |
|||
return |
|||
# job = basic.program.SimpleJob(PROGRAM_NAME) |
|||
#job = test.testtools.getWorkspaceJob(PROGRAM_NAME) |
|||
for x in ["_variants", "_variant", "subtable:_variants", "subtable:variants"]: |
|||
res = tools.data_tool.getPurKeyword(x) |
|||
self.assertEqual(res, "variant") |
|||
|
|||
def test_zzz(self): |
|||
print(MyTestCase.mymsg) |
|||
|
|||
if __name__ == '__main__': |
|||
unittest.main() |
@ -0,0 +1,21 @@ |
|||
|
|||
def getPurKeyword(inkey): |
|||
""" |
|||
each key is case-insensitve in lower case. |
|||
A keyword can have a singular or plural form - so the plural-s at the end is optional. |
|||
A keyword can be assigned as keyword by the beginning digit underscore - so it is optional too. |
|||
A keyword in a csv-file can be characterized by the keyword delimited with the in-filed-delimiter colon. |
|||
a sub-keyword can be delimited |
|||
:param inkey: |
|||
:return: |
|||
""" |
|||
keyPur = inkey.lower() |
|||
if ":" in keyPur: |
|||
keyPur = keyPur.split(":").pop() |
|||
if "-" in keyPur: |
|||
keyPur = keyPur.split("-").pop() |
|||
if keyPur[0:1] == "_": |
|||
keyPur = keyPur[1:] |
|||
if keyPur[-1:] == "s": |
|||
keyPur = keyPur[:-1] |
|||
return keyPur |
Loading…
Reference in new issue