def test_invalid_constructor(): # bad Graph with pytest.raises(ValueError): GraphFrame(None, None) # bad dataframe with pytest.raises(ValueError): GraphFrame(Graph([]), None) # dataframe has no "node" index with pytest.raises(ValueError): GraphFrame(Graph([]), pd.DataFrame())
def test_graphframe(lulesh_caliper_json): """Sanity test a GraphFrame object with known data.""" gf = GraphFrame() gf.from_caliper(str(lulesh_caliper_json)) assert len(gf.dataframe.groupby('name')) == 24
def test_graphframe(mock_graph_literal): """Sanity test a GraphFrame object with known data.""" gf = GraphFrame() gf.from_literal(mock_graph_literal) assert len(gf.dataframe) == 20
def test_graphframe(calc_pi_callgrind_dot): """Sanity test a GraphFrame object with known data.""" gf = GraphFrame() gf.from_gprof_dot(str(calc_pi_callgrind_dot)) assert len(gf.dataframe.groupby('name')) == 105
def test_filter(mock_graph_literal): """Test the filter operation with a foo-bar tree.""" gf = GraphFrame() gf.from_literal(mock_graph_literal) filtered_gf = gf.filter(lambda x: x['time'] > 5.0) assert len(filtered_gf.dataframe) == 7
def test_graphframe(calc_pi_hpct_db): """Sanity test a GraphFrame object with known data.""" gf = GraphFrame() gf.from_hpctoolkit(str(calc_pi_hpct_db)) assert len(gf.dataframe.groupby('module')) == 5 assert len(gf.dataframe.groupby('file')) == 11 assert len(gf.dataframe.groupby('name')) == 20