summaryrefslogtreecommitdiff
path: root/src/local/domain/cri.rhizi.net/test_domain__CRI.py
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-05-17 17:57:00 +0300
committerLV-426 <lv-426@taproot.org.il>2015-05-17 18:07:51 +0300
commit7e13f1fc247e8157abedbdf3f20e95012dee7a05 (patch)
tree163d0157c06aa673ade9c7601d2498356f3532d8 /src/local/domain/cri.rhizi.net/test_domain__CRI.py
parentbe61af9c3f8bca1428dad7eaba1ad6c8da58e666 (diff)
refactoring DBO_RDG__skill_graph out of Test_Domain_CRI
Diffstat (limited to 'src/local/domain/cri.rhizi.net/test_domain__CRI.py')
-rw-r--r--src/local/domain/cri.rhizi.net/test_domain__CRI.py114
1 files changed, 106 insertions, 8 deletions
diff --git a/src/local/domain/cri.rhizi.net/test_domain__CRI.py b/src/local/domain/cri.rhizi.net/test_domain__CRI.py
index 54131bbd..652c04a6 100644
--- a/src/local/domain/cri.rhizi.net/test_domain__CRI.py
+++ b/src/local/domain/cri.rhizi.net/test_domain__CRI.py
@@ -4,17 +4,20 @@ import tempfile
import unittest
import db_controller as dbc
-from db_op import DBO_cypher_query
-from domain_cri import DBO_random_data_generation__domain__CRI
-from rz_server import Config
+from db_op import DBO_cypher_query, DBO_rzdoc__create
+from neo4j_test_util import rand_label
+from rz_config import RZ_Config
+from test_util import generate_random_RZDoc
+from test_util__pydev import debug__pydev_pd_arg
+from test_util__rzdoc import DBO_RDG__skill_graph
class Test_Domain_CRI(unittest.TestCase):
@classmethod
def setUpClass(self):
- cfg = Config.init_from_file('res/etc/rhizi-server.conf')
- self.db_ctl = dbc.DB_Controller(cfg)
+ cfg = RZ_Config.init_from_file('res/etc/rhizi-server.conf')
+ self.db_ctl = dbc.DB_Controller(cfg.neo4j_url)
self.log = logging.getLogger('rhizi')
self.log.addHandler(logging.StreamHandler())
@@ -24,7 +27,95 @@ class Test_Domain_CRI(unittest.TestCase):
- random CRI domain data generation
- DB dump in cvs format: person x skill x skill-level
"""
- op = DBO_random_data_generation__domain__CRI()
+
+ skill_set = ['Cryptocurrency',
+ 'Database architecture',
+ 'Web-development',
+ 'Mobile-development',
+ 'Machine learning',
+ 'Guitar Playing',
+ 'Image processing',
+ 'Algebra',
+ 'Calculus',
+ 'Molecular-Biology',
+ 'Graphic design',
+ 'Geo-location services',
+ 'Drone-building',
+ 'Artificial-intelligence',
+ 'Distributed information systems',
+ 'Wordpress',
+ 'Woodworking',
+ 'Quality-control',
+ 'Video-editing',
+ 'Soldering',
+ 'Network engineering',
+ 'GIT',
+ 'Electronic music',
+ 'Network administration']
+
+ name_set = ['John',
+ 'William',
+ 'James',
+ 'Charles',
+ 'George',
+ 'Frank',
+ 'Joseph',
+ 'Thomas',
+ 'Henry',
+ 'Robert',
+ 'Edward',
+ 'Harry',
+ 'Walter',
+ 'Arthur',
+ 'Fred',
+ 'Albert',
+ 'Samuel',
+ 'David',
+ 'Louis',
+ 'Joe',
+ 'Charlie',
+ 'Clarence',
+ 'Richard',
+ 'Andrew',
+ 'Daniel',
+ 'Ernest',
+ 'Mary',
+ 'Anna',
+ 'Emma',
+ 'Elizabeth',
+ 'Minnie',
+ 'Margaret',
+ 'Ida',
+ 'Alice',
+ 'Bertha',
+ 'Sarah',
+ 'Annie',
+ 'Clara',
+ 'Ella',
+ 'Florence',
+ 'Cora',
+ 'Martha',
+ 'Laura',
+ 'Nellie',
+ 'Grace',
+ 'Carrie',
+ 'Maude',
+ 'Mabel',
+ 'Bessie',
+ 'Jennie',
+ 'Gertrude',
+ 'Julia']
+
+ test_label = rand_label()
+ rzdoc = generate_random_RZDoc(test_label)
+
+ op = DBO_rzdoc__create(rzdoc)
+ self.db_ctl.exec_op(op)
+
+ op = DBO_RDG__skill_graph(rzdoc,
+ lim_n=10,
+ skill_set=skill_set,
+ name_set=name_set)
self.db_ctl.exec_op(op)
if False == export_as_csv:
@@ -37,10 +128,13 @@ class Test_Domain_CRI(unittest.TestCase):
]
op = DBO_cypher_query(q_arr)
+ #
+ # write csv file
+ #
cur_f_name = inspect.stack()[0][3]
def q_process_result_set():
with tempfile.NamedTemporaryFile(prefix='rz_%s' % (cur_f_name), dir='/tmp', suffix='.csv', delete=False) as f_out:
- for _, _, r_set in op:
+ for _, _, r_set in op.iter__r_set():
for row in r_set:
person_name, skill_dict_set = row # person to {sname: skill, s:pro: skill_level{ dict set
cvs_line_arr = [person_name]
@@ -54,5 +148,9 @@ class Test_Domain_CRI(unittest.TestCase):
op.process_result_set = q_process_result_set
self.db_ctl.exec_op(op)
-if __name__ == "__main__":
+@debug__pydev_pd_arg
+def main():
unittest.main()
+
+if __name__ == "__main__":
+ main()