Procházet zdrojové kódy

添加验证竖管的test

jxing před 5 roky
rodič
revize
65f1639326
1 změnil soubory, kde provedl 39 přidání a 79 odebrání
  1. 39 79
      src/vertical_pipe/test.py

+ 39 - 79
src/vertical_pipe/test.py

@@ -1,17 +1,46 @@
 # -*- coding: utf-8 -*-
 
 import json
+import sys
 
 import psycopg2
 
-from adjacent import calc_adjacent_relation
+from src.saga_mark.check_saga_mark import check_saga_mark
 
+involved_model_keys = [
+    'id',
+    'floor_name',
+    'project_id',
+    'folder_id',
+    'fid',
+    'accept_time',
+    'version',
+    'note',
+    'user_id',
+    'user_name',
+    'log',
+    'url',
+    'md5',
+    'status'
+]
 
+level_keys = [
+    'id',
+    'model_id',
+    'name',
+    'elevation',
+    'last_update',
+    'create_time',
+    'type',
+    'revit_id',
+    'source_id',
+]
 def get_data(sql):
+    global connection, cursor
     record = []
     try:
         connection = psycopg2.connect(
-            database='postgres',
+            database='datacenter',
             user='postgres',
             password='123456',
             host='192.168.20.234',
@@ -23,7 +52,7 @@ def get_data(sql):
     except (Exception, psycopg2.Error) as error:
         print("Error while connecting to PostgreSQL", error)
     finally:
-        if (connection):
+        if connection:
             cursor.close()
             connection.close()
             print('PostgreSQL connection is closed')
@@ -42,79 +71,10 @@ def loads_curve(x):
 
 
 if __name__ == '__main__':
-    segment_sql = "SELECT * FROM revit.boundary_segment where model_id = '8544a3c3cd2611e99abc839db1015353'"
-    wall_sql = "SELECT * FROM revit.wall where model_id = '8544a3c3cd2611e99abc839db1015353'"
-    v_wall_sql = "SELECT * FROM revit.virtual_wall where model_id = '8544a3c3cd2611e99abc839db1015353'"
-    columns_sql = "SELECT * FROM revit.column where model_id = '8544a3c3cd2611e99abc839db1015353'"
-    segment_data = get_data(segment_sql)
-    wall_data = get_data(wall_sql)
-    v_wall_data = get_data(v_wall_sql)
-    columns_data = get_data(columns_sql)
-    SEGMENT_KEYS = [
-        'id',
-        'model_id',
-        'belong',
-        'belong_type',
-        'curve',
-        'space_id',
-        'group_index',
-        'sequence',
-        'reference',
-        'revit_id',
-        'type',
-    ]
-    WALL_KEYS = [
-        'id',
-        'model_id',
-        'level_id',
-        'width',
-        'location',
-        'outline',
-        'last_update',
-        'create_time',
-        'name',
-        'source_id',
-        'revit_id',
-        'type',
-    ]
-    V_WALL_KEYS = [
-        'id',
-        'model_id',
-        'location',
-        'outline',
-        'last_update',
-        'create_time',
-        'name',
-        'source_id',
-        'revit_id',
-        'type',
-    ]
-    COLUMNS_KEYS = [
-        'id',
-        'model_id',
-        'location',
-        'outline',
-        'bounding',
-        'last_update',
-        'create_time',
-        'name',
-        'source_id',
-        'revit_id',
-        'type',
-    ]
-    segment_data = [dict(zip(SEGMENT_KEYS, item)) for item in segment_data]
-    segment_data = list(map(loads_curve, segment_data))
-    wall_data = [dict(zip(WALL_KEYS, item)) for item in wall_data]
-    wall_data = list(map(loads, wall_data))
-    v_wall_data = [dict(zip(V_WALL_KEYS, item)) for item in v_wall_data]
-    v_wall_data = list(map(loads, v_wall_data))
-    columns_data = [dict(zip(COLUMNS_KEYS, item)) for item in columns_data]
-    columns_data = list(map(loads, columns_data))
-    test_result = calc_adjacent_relation(
-        segments=segment_data,
-        walls=wall_data,
-        v_walls=v_wall_data,
-        columns=columns_data
-    )
-    for item in test_result:
-        print(item)
+    for i in range(0, 100):
+        tmp = -0.5 + i
+        print('var = {}, round = {}'.format(tmp, round(tmp)))
+
+    for i in range(0, 100):
+        tmp = -0.45 + i
+        print('var = {}, round = {}'.format(tmp, round(tmp)))