예제 #1
0
 def test_select_invalid_filter_column(
     self,
     rec_id,
     res_id,
     config_file_path,
     schema_file_path,
 ):
     args = dict(
         schema_path=schema_file_path, namespace="test", config=config_file_path
     )
     psm = PipestatManager(**args)
     with pytest.raises(ValueError):
         psm.select(
             filter_conditions=[("bogus_column", "eq", rec_id)],
             columns=[res_id],
         )
예제 #2
0
 def test_select_invalid_filter_structure(
     self,
     res_id,
     config_file_path,
     schema_file_path,
     filter,
 ):
     args = dict(
         schema_path=schema_file_path, namespace="test", config=config_file_path
     )
     psm = PipestatManager(**args)
     with pytest.raises((ValueError, TypeError)):
         psm.select(
             filter_conditions=[filter],
             columns=[res_id],
         )
예제 #3
0
 def test_select_offset(
     self,
     config_file_path,
     schema_file_path,
     offset,
 ):
     args = dict(
         schema_path=schema_file_path, namespace="test", config=config_file_path
     )
     psm = PipestatManager(**args)
     result = psm.select(offset=offset)
     print(result)
     assert len(result) == max((psm.record_count - offset), 0)
예제 #4
0
 def test_select_limit(
     self,
     rec_id,
     res_id,
     config_file_path,
     schema_file_path,
     limit,
 ):
     args = dict(
         schema_path=schema_file_path, namespace="test", config=config_file_path
     )
     psm = PipestatManager(**args)
     result = psm.select(
         filter_conditions=[(RECORD_ID, "eq", rec_id)],
         columns=[res_id],
         limit=limit,
     )
     assert len(result) <= limit
예제 #5
0
 def test_report(
     self,
     val,
     config_file_path,
     schema_file_path,
 ):
     REC_ID = "constant_record_id"
     psm = PipestatManager(
         schema_path=schema_file_path,
         namespace="test",
         record_identifier=REC_ID,
         database_only=True,
         config=config_file_path,
     )
     psm.report(values=val)
     assert len(psm.data) == 0
     val_name = list(val.keys())[0]
     assert psm.select(filter_conditions=[(val_name, "eq", str(val[val_name]))])