Skip to content

Commit

Permalink
Updated code
Browse files Browse the repository at this point in the history
  • Loading branch information
venvis committed Mar 6, 2024
1 parent 905d223 commit 36cc239
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 121 deletions.
50 changes: 50 additions & 0 deletions cellar/cellar_extractor/Testing_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,56 @@
from eurlex_scraping import *
from cellar import *
from sparql import *
import unittest
from operative_extraction import Analyzer
# from test import testing
import random
import csv
file=open("gijs_202310_node_list.tsv","r")
reader=csv.reader(file)
no_of_test_cases=30
testing=[]
for row in reader:
for rows in row:
if "Id" not in rows:
testing.append(rows.split("\t")[0])
class Test(unittest.TestCase):
"""
class for unittesing operative part , it checks whether the list returns null value or has some value.
"""
ids:list
def __init__(self,ids):
self.ids=ids

def test_for_celex_id(self):
"""
Main function which runs the unittest Testcase .
"""
count_fail:int
count_pass=0
for id in self.ids:
test_output=Analyzer(id)
test_instance=test_output()

# self.assertFalse(len(test_instance)<=1)

try:
self.assertTrue(test_instance[0],f"{id} is not empty and has operative part")
count_pass+=1
print(f"{id} ---> PASSED.")
except:
print(f"{id} ---> FAILED.")
print(f"Passed {count_pass}/{len(self.ids)} times")
# print(len(self.ids)-count,"were passed successfully")

new_list=[]
for w in range(no_of_test_cases):
randomized=random.randint(0,len(testing)-1)
new_list.append(testing[randomized])


instance=Test(new_list)
instance.test_for_celex_id()



Expand Down
Loading

0 comments on commit 36cc239

Please sign in to comment.