mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-06-21 19:03:55 +02:00
Added test
This commit is contained in:
@ -45,11 +45,11 @@ def create_2d_graph( # noqa PLR0913
|
||||
# pos = nx.planar_layout(graph)
|
||||
case "Random":
|
||||
pos = nx.random_layout(graph)
|
||||
case "Shell only 2D)":
|
||||
case "(Shell only 2D)":
|
||||
pos = nx.shell_layout(graph)
|
||||
# case "Spectral":
|
||||
# pos = nx.spectral_layout(graph)
|
||||
case "Spiral only 2D)":
|
||||
case "(Spiral only 2D)":
|
||||
pos = nx.spiral_layout(graph)
|
||||
# case "Multipartite":
|
||||
# pos = nx.multipartite_layout(graph)
|
||||
|
@ -22,20 +22,28 @@ def initialize_network(edges: list, nodes: dict) -> tuple[nx.Graph, pd.DataFrame
|
||||
|
||||
# update node attributes from dataframe
|
||||
nx.set_node_attributes(graph, nodes)
|
||||
|
||||
# Create a DataFrame with all Metrics
|
||||
# Create a DataFrame with all Metrics
|
||||
metrics = pd.DataFrame(
|
||||
{
|
||||
"eigenvector": nx.eigenvector_centrality(graph).values(),
|
||||
"degree": nx.degree_centrality(graph).values(),
|
||||
"betweenness": nx.betweenness_centrality(graph).values(),
|
||||
"closeness": nx.closeness_centrality(graph).values(),
|
||||
"pagerank": nx.pagerank(graph).values(),
|
||||
"category": nx.get_node_attributes(graph, "type").values(),
|
||||
"designation": nx.get_node_attributes(graph, "name").values(),
|
||||
"id": nx.get_node_attributes(graph, "id").values(),
|
||||
}
|
||||
).T
|
||||
columns=[
|
||||
"eigenvector",
|
||||
"degree",
|
||||
"betweenness",
|
||||
"closeness",
|
||||
"pagerank",
|
||||
"category",
|
||||
"designation",
|
||||
"id",
|
||||
]
|
||||
)
|
||||
metrics["eigenvector"] = nx.eigenvector_centrality(graph).values()
|
||||
metrics["degree"] = nx.degree_centrality(graph).values()
|
||||
metrics["betweenness"] = nx.betweenness_centrality(graph).values()
|
||||
metrics["closeness"] = nx.closeness_centrality(graph).values()
|
||||
metrics["pagerank"] = nx.pagerank(graph).values()
|
||||
metrics["category"] = nx.get_node_attributes(graph, "type").values()
|
||||
metrics["designation"] = nx.get_node_attributes(graph, "name").values()
|
||||
metrics["id"] = nx.get_node_attributes(graph, "id").values()
|
||||
|
||||
return graph, metrics
|
||||
|
||||
@ -64,7 +72,7 @@ def initialize_network_with_reduced_metrics(
|
||||
|
||||
# Create a DataFrame with all Metrics
|
||||
metrics = pd.DataFrame(
|
||||
columns=["degree", "eigenvector", "betweenness", "closeness", "pagerank"]
|
||||
columns=["degree", "betweenness", "closeness", "category", "designation", "id"]
|
||||
)
|
||||
# metrics["eigenvector"] = nx.eigenvector_centrality(graph).values()
|
||||
metrics["degree"] = nx.degree_centrality(graph).values()
|
||||
|
@ -63,24 +63,6 @@ def find_all_company_relations() -> pd.DataFrame:
|
||||
return companies_relations_df
|
||||
|
||||
|
||||
def find_top_companies() -> pd.DataFrame:
|
||||
"""_summary_.
|
||||
|
||||
Returns:
|
||||
pd.DataFrame: _description_
|
||||
"""
|
||||
session = SessionHandler.session
|
||||
assert session # noqa: S101
|
||||
query_companies = session.query(entities.Company) # .all()
|
||||
|
||||
companies_df: pd.DataFrame = pd.read_sql(str(query_companies), session.bind) # type: ignore
|
||||
companies_df = companies_df.head()
|
||||
companies_df = companies_df[["company_name"]]
|
||||
companies_df["Platzierung"] = [1, 2, 3, 4, 5]
|
||||
companies_df["Umsatz M€"] = [1, 2, 3, 4, 5]
|
||||
return companies_df[["Platzierung", "company_name", "Umsatz M€"]]
|
||||
|
||||
|
||||
def get_all_company_relations() -> pd.DataFrame:
|
||||
"""This Methods makes a Database Request for all Companies and their relations, modifies the ID Column and returns the Result as an DataFrame.
|
||||
|
||||
@ -380,7 +362,7 @@ def create_edge_and_node_list_for_company(
|
||||
return nodes, edges
|
||||
|
||||
|
||||
def get_all_metrics_from_id(company_id: int) -> pd.Series:
|
||||
def get_all_metrics_from_id(company_id: str) -> pd.Series:
|
||||
"""Returns all Metric for the given ID.
|
||||
|
||||
Args:
|
||||
|
@ -1,7 +0,0 @@
|
||||
"""Test for the NetworkX Component."""
|
||||
from aki_prj23_transparenzregister.ui.archive import networkx_dash
|
||||
|
||||
|
||||
def network_graph(edges: None) -> None:
|
||||
"""Checks if an import co company_stats_dash can be made."""
|
||||
assert networkx_dash is not None
|
@ -2,15 +2,21 @@
|
||||
import datetime
|
||||
from collections.abc import Generator
|
||||
|
||||
import networkx as nx
|
||||
import pandas as pd
|
||||
import plotly.graph_objects as go
|
||||
import pytest
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from aki_prj23_transparenzregister.ui.session_handler import SessionHandler
|
||||
from aki_prj23_transparenzregister.utils.networkx import network_2d
|
||||
from aki_prj23_transparenzregister.utils.networkx.network_2d import create_2d_graph
|
||||
from aki_prj23_transparenzregister.utils.networkx.network_base import initialize_network
|
||||
|
||||
|
||||
def test_import() -> None:
|
||||
"""Checks if an import co company_stats_dash can be made."""
|
||||
assert network_2d is not None
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _set_session(full_db: Session) -> Generator[None, None, None]:
|
||||
"""Sets a session for the dash application to be used."""
|
||||
@ -19,32 +25,79 @@ def _set_session(full_db: Session) -> Generator[None, None, None]:
|
||||
SessionHandler.session = None
|
||||
|
||||
|
||||
def test_initialize_network() -> None:
|
||||
def test_create_2d_graph() -> None:
|
||||
"""Tests the creation of a 2D Graph."""
|
||||
edges: list = [
|
||||
{"from": "p_545", "to": "c_53", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_53", "to": "p_545", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_1", "to": "c_2", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_53", "to": "c_1", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
]
|
||||
nodes: dict = {
|
||||
"c_53": {
|
||||
"id": "c_53",
|
||||
"name": "1. Freiburger Solarfonds Beteiligungs-KG",
|
||||
"type": "company",
|
||||
"color": "blue",
|
||||
},
|
||||
"p_545": {
|
||||
"id": "p_545",
|
||||
"firstname": "Jürgen",
|
||||
"lastname": "Wetzel",
|
||||
"name": "Wetzel, Jürgen",
|
||||
"type": "person",
|
||||
"date_of_birth": datetime.date(1962, 11, 15),
|
||||
"color": "red",
|
||||
},
|
||||
"c_1": {
|
||||
"id": "c_1",
|
||||
"name": "Musterfirma",
|
||||
"type": "company",
|
||||
"color": "blue",
|
||||
},
|
||||
"c_2": {
|
||||
"id": "c_2",
|
||||
"name": "Firma 1",
|
||||
"type": "company",
|
||||
"color": "blue",
|
||||
},
|
||||
}
|
||||
graph, metrics = initialize_network(edges=edges, nodes=nodes)
|
||||
assert type(graph) is nx.Graph
|
||||
assert type(metrics) is pd.DataFrame
|
||||
# assert list(metrics.columns) == [
|
||||
# "degree",
|
||||
# "eigenvector",
|
||||
# "betweeness",
|
||||
# "closeness",
|
||||
# "pagerank",
|
||||
# ]
|
||||
metric = "None"
|
||||
layout = "Spring"
|
||||
edge_annotation = False
|
||||
edge_thickness = 1
|
||||
figure = create_2d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
||||
metric = "degree"
|
||||
layout = "Circular"
|
||||
figure = create_2d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
||||
edge_annotation = True
|
||||
layout = "Kamada Kawai"
|
||||
figure = create_2d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
||||
layout = "Random"
|
||||
figure = create_2d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
||||
layout = "Shell (only 2D)"
|
||||
figure = create_2d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
||||
layout = "Spiral (only 2D)"
|
||||
figure = create_2d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
@ -1,38 +1,79 @@
|
||||
"""Test the initialize Network function."""
|
||||
import datetime
|
||||
|
||||
import networkx as nx
|
||||
import pandas as pd
|
||||
import plotly.graph_objects as go
|
||||
|
||||
from aki_prj23_transparenzregister.utils.networkx import network_3d
|
||||
from aki_prj23_transparenzregister.utils.networkx.network_3d import create_3d_graph
|
||||
from aki_prj23_transparenzregister.utils.networkx.network_base import initialize_network
|
||||
|
||||
|
||||
def test_initialize_network() -> None:
|
||||
def test_import() -> None:
|
||||
"""Checks if an import co company_stats_dash can be made."""
|
||||
assert network_3d is not None
|
||||
|
||||
|
||||
def test_create_3d_graph() -> None:
|
||||
"""Tests the creation of a 3D Graph."""
|
||||
edges: list = [
|
||||
{"from": "p_545", "to": "c_53", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_53", "to": "p_545", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_1", "to": "c_2", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_53", "to": "c_1", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
]
|
||||
nodes: dict = {
|
||||
"c_53": {
|
||||
"id": "c_53",
|
||||
"name": "1. Freiburger Solarfonds Beteiligungs-KG",
|
||||
"type": "company",
|
||||
"color": "blue",
|
||||
},
|
||||
"p_545": {
|
||||
"id": "p_545",
|
||||
"firstname": "Jürgen",
|
||||
"lastname": "Wetzel",
|
||||
"name": "Wetzel, Jürgen",
|
||||
"type": "person",
|
||||
"date_of_birth": datetime.date(1962, 11, 15),
|
||||
"color": "red",
|
||||
},
|
||||
"c_1": {
|
||||
"id": "c_1",
|
||||
"name": "Musterfirma",
|
||||
"type": "company",
|
||||
"color": "blue",
|
||||
},
|
||||
"c_2": {
|
||||
"id": "c_2",
|
||||
"name": "Firma 1",
|
||||
"type": "company",
|
||||
"color": "blue",
|
||||
},
|
||||
}
|
||||
graph, metrics = initialize_network(edges=edges, nodes=nodes)
|
||||
assert type(graph) is nx.Graph
|
||||
assert type(metrics) is pd.DataFrame
|
||||
# assert list(metrics.columns) == [
|
||||
# "degree",
|
||||
# "eigenvector",
|
||||
# "betweeness",
|
||||
# "closeness",
|
||||
# "pagerank",
|
||||
# ]
|
||||
metric = "None"
|
||||
layout = "Spring"
|
||||
edge_annotation = False
|
||||
edge_thickness = 1
|
||||
figure = create_3d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
||||
metric = "degree"
|
||||
layout = "Circular"
|
||||
figure = create_3d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
||||
edge_annotation = True
|
||||
layout = "Kamada Kawai"
|
||||
figure = create_3d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
||||
layout = "Random"
|
||||
figure = create_3d_graph(
|
||||
graph, nodes, edges, metrics, metric, layout, edge_annotation, edge_thickness
|
||||
)
|
||||
assert type(figure) is go.Figure
|
||||
|
@ -3,38 +3,83 @@ import datetime
|
||||
|
||||
import networkx as nx
|
||||
import pandas as pd
|
||||
import pytest
|
||||
|
||||
from aki_prj23_transparenzregister.utils.networkx.network_base import initialize_network
|
||||
from aki_prj23_transparenzregister.utils.networkx import network_base
|
||||
from aki_prj23_transparenzregister.utils.networkx.network_base import (
|
||||
initialize_network,
|
||||
initialize_network_with_reduced_metrics,
|
||||
initialize_network_without_metrics,
|
||||
)
|
||||
|
||||
|
||||
def test_import() -> None:
|
||||
"""Checks if an import co company_stats_dash can be made."""
|
||||
assert network_base is not None
|
||||
|
||||
|
||||
@pytest.mark.tim()
|
||||
def test_initialize_network() -> None:
|
||||
edges: list = [
|
||||
{"from": "p_545", "to": "c_53", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_53", "to": "p_545", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_1", "to": "c_2", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_53", "to": "c_1", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
]
|
||||
nodes: dict = {
|
||||
"c_53": {
|
||||
"id": "c_53",
|
||||
"name": "1. Freiburger Solarfonds Beteiligungs-KG",
|
||||
"type": "company",
|
||||
"color": "blue",
|
||||
},
|
||||
"p_545": {
|
||||
"id": "p_545",
|
||||
"firstname": "Jürgen",
|
||||
"lastname": "Wetzel",
|
||||
"name": "Wetzel, Jürgen",
|
||||
"type": "person",
|
||||
"date_of_birth": datetime.date(1962, 11, 15),
|
||||
"color": "red",
|
||||
},
|
||||
"c_1": {
|
||||
"id": "c_1",
|
||||
"name": "Musterfirma",
|
||||
"type": "company",
|
||||
"color": "blue",
|
||||
},
|
||||
"c_2": {
|
||||
"id": "c_2",
|
||||
"name": "Firma 1",
|
||||
"type": "company",
|
||||
"color": "blur",
|
||||
},
|
||||
}
|
||||
# print(len(edges))
|
||||
# print(len(nodes))
|
||||
graph, metrics = initialize_network(edges=edges, nodes=nodes)
|
||||
assert isinstance(graph, nx.Graph)
|
||||
assert isinstance(metrics, pd.DataFrame)
|
||||
# assert list(metrics.columns) == [
|
||||
# "degree",
|
||||
# "eigenvector",
|
||||
# "betweeness",
|
||||
# "closeness",
|
||||
# "pagerank",
|
||||
# ]
|
||||
assert list(metrics.columns) == [
|
||||
"eigenvector",
|
||||
"degree",
|
||||
"betweenness",
|
||||
"closeness",
|
||||
"pagerank",
|
||||
"category",
|
||||
"designation",
|
||||
"id",
|
||||
]
|
||||
|
||||
graph_reduced, metrics_reduced = initialize_network_with_reduced_metrics(
|
||||
edges=edges, nodes=nodes
|
||||
)
|
||||
assert isinstance(graph_reduced, nx.Graph)
|
||||
assert isinstance(metrics_reduced, pd.DataFrame)
|
||||
assert list(metrics_reduced.columns) == [
|
||||
"degree",
|
||||
"betweenness",
|
||||
"closeness",
|
||||
"category",
|
||||
"designation",
|
||||
"id",
|
||||
]
|
||||
|
||||
graph = initialize_network_without_metrics(edges=edges, nodes=nodes)
|
||||
assert isinstance(graph_reduced, nx.Graph)
|
||||
|
@ -1,37 +1,150 @@
|
||||
"""Test the initialize Network function."""
|
||||
import datetime
|
||||
from collections.abc import Generator
|
||||
|
||||
import networkx as nx
|
||||
import pandas as pd
|
||||
import pytest
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from aki_prj23_transparenzregister.utils.networkx.network_base import initialize_network
|
||||
from aki_prj23_transparenzregister.ui.session_handler import SessionHandler
|
||||
from aki_prj23_transparenzregister.utils.networkx import networkx_data
|
||||
from aki_prj23_transparenzregister.utils.networkx.networkx_data import (
|
||||
create_edge_and_node_list,
|
||||
create_edge_and_node_list_for_company,
|
||||
filter_relation_type,
|
||||
filter_relation_with_more_than_one_connection,
|
||||
find_all_company_relations,
|
||||
find_company_relations,
|
||||
get_all_company_relations,
|
||||
get_all_person_relations,
|
||||
)
|
||||
|
||||
|
||||
def test_initialize_network() -> None:
|
||||
edges: list = [
|
||||
{"from": "p_545", "to": "c_53", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
{"from": "c_53", "to": "p_545", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
]
|
||||
nodes: dict = {
|
||||
"c_53": {
|
||||
"id": "c_53",
|
||||
"name": "1. Freiburger Solarfonds Beteiligungs-KG",
|
||||
"color": "blue",
|
||||
},
|
||||
"p_545": {
|
||||
"id": "p_545",
|
||||
"name": "Jürgen Wenzel",
|
||||
"date_of_birth": datetime.date(1962, 11, 15),
|
||||
"color": "red",
|
||||
},
|
||||
}
|
||||
graph, metrics = initialize_network(edges=edges, nodes=nodes)
|
||||
assert type(graph) is nx.Graph
|
||||
assert type(metrics) is pd.DataFrame
|
||||
# assert list(metrics.columns) == [
|
||||
# "degree",
|
||||
# "eigenvector",
|
||||
# "betweeness",
|
||||
# "closeness",
|
||||
# "pagerank",
|
||||
# ]
|
||||
@pytest.fixture(autouse=True)
|
||||
def _set_session(full_db: Session) -> Generator[None, None, None]:
|
||||
"""Sets a session for the dash application to be used."""
|
||||
SessionHandler.session = full_db
|
||||
yield
|
||||
SessionHandler.session = None
|
||||
|
||||
|
||||
def test_import() -> None:
|
||||
"""Checks if an import co company_stats_dash can be made."""
|
||||
assert networkx_data is not None
|
||||
|
||||
|
||||
# def test_initialize_network() -> None:
|
||||
# edges: list = [
|
||||
# {"from": "p_545", "to": "c_53", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
# {"from": "c_53", "to": "p_545", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
# {"from": "c_1", "to": "c_2", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
# {"from": "c_53", "to": "c_1", "type": "HAFTENDER_GESELLSCHAFTER"},
|
||||
# ]
|
||||
# nodes: dict = {
|
||||
# "c_53": {
|
||||
# "id": "c_53",
|
||||
# "name": "1. Freiburger Solarfonds Beteiligungs-KG",
|
||||
# "type": "company",
|
||||
# "color": "blue",
|
||||
# },
|
||||
# "p_545": {
|
||||
# "id": "p_545",
|
||||
# "name": "Wetzel, Jürgen",
|
||||
# "type": "person",
|
||||
# "date_of_birth": datetime.date(1962, 11, 15),
|
||||
# "color": "red",
|
||||
# },
|
||||
# "c_1": {
|
||||
# "id": "c_1",
|
||||
# "name": "Musterfirma",
|
||||
# "type": "company",
|
||||
# "color": "blue",
|
||||
# },
|
||||
# "c_2": {
|
||||
# "id": "c_2",
|
||||
# "name": "Firma 1",
|
||||
# "type": "company",
|
||||
# "color": "blur",
|
||||
# },
|
||||
# }
|
||||
|
||||
|
||||
def test_find_all_company_relations() -> None:
|
||||
"""This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
company_relations_df = find_all_company_relations()
|
||||
assert type(company_relations_df) is pd.DataFrame
|
||||
|
||||
|
||||
def test_get_all_company_relations() -> None:
|
||||
"""This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
company_relations_df = get_all_company_relations()
|
||||
assert type(company_relations_df) is pd.DataFrame
|
||||
|
||||
|
||||
def test_get_all_person_relations() -> None:
|
||||
"""This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
company_relations_df = get_all_person_relations()
|
||||
assert type(company_relations_df) is pd.DataFrame
|
||||
|
||||
|
||||
def test_filter_relation_type() -> None:
|
||||
"""This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
relation_dataframe = get_all_company_relations()
|
||||
selected_relation_type = "HAFTENDER_GESELLSCHAFTER"
|
||||
company_relations_df = filter_relation_type(
|
||||
relation_dataframe, selected_relation_type
|
||||
)
|
||||
assert type(company_relations_df) is pd.DataFrame
|
||||
|
||||
|
||||
def test_filter_relation_with_more_than_one_connection() -> None:
|
||||
"""This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
relation_dataframe = get_all_company_relations()
|
||||
id_column_name_to = "c_1"
|
||||
id_column_name_from = "c_2"
|
||||
relations_df = filter_relation_with_more_than_one_connection(
|
||||
relation_dataframe, id_column_name_to, id_column_name_from
|
||||
)
|
||||
assert type(relations_df) is pd.DataFrame
|
||||
|
||||
|
||||
def test_create_edge_and_node_list() -> None:
|
||||
"""This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
person_df = get_all_person_relations()
|
||||
company_df = get_all_company_relations()
|
||||
nodes, edges = create_edge_and_node_list(person_df, company_df)
|
||||
assert isinstance(nodes, dict)
|
||||
assert isinstance(edges, list)
|
||||
|
||||
|
||||
def test_find_company_relations() -> None:
|
||||
"""This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
selected_company_id = 1
|
||||
company_relations_df, person_df = find_company_relations(selected_company_id)
|
||||
assert type(company_relations_df) is pd.DataFrame
|
||||
assert type(person_df) is pd.DataFrame
|
||||
|
||||
|
||||
def test_create_edge_and_node_list_for_company() -> None:
|
||||
"""This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
company_relations = get_all_company_relations()
|
||||
nodes, edges = create_edge_and_node_list_for_company(company_relations)
|
||||
assert isinstance(nodes, dict)
|
||||
assert isinstance(edges, list)
|
||||
|
||||
|
||||
# @pytest.mark.tim()
|
||||
# def test_get_all_metrics_from_id() -> None:
|
||||
# """This Test methods tests if the correct type is returned for the corresponding Function."""
|
||||
# company_id = 2549
|
||||
# metrics = get_all_metrics_from_id(company_id)
|
||||
# assert type(metrics) is pd.Series
|
||||
|
||||
# @pytest.mark.tim()
|
||||
# def test_get_relations_number_from_id() -> None:
|
||||
# """This Test methods tests if the correct type and number of relations is received."""
|
||||
# # id = "c_2549"
|
||||
# id = "c_2667"
|
||||
# relations_lvl_1, relations_lvl_2, relations_lvl_3 = get_relations_number_from_id(id)
|
||||
# assert type(relations_lvl_1) is int
|
||||
# assert type(relations_lvl_2) is int
|
||||
# assert type(relations_lvl_3) is int
|
||||
|
Reference in New Issue
Block a user