From c6ac35df6b439eeaa700bb7ec7431fd6ca17cc77 Mon Sep 17 00:00:00 2001 From: Philip Mathieu Date: Mon, 1 Apr 2024 14:45:55 -0400 Subject: [PATCH] Update tests and environment --- environment.yml | 11 +++ graphreadability.yml | 16 ---- .../tests/test_graphreadability.py | 1 - .../tests/test_readabilitygraph.py | 90 ------------------- graphreadability/utils/helpers.py | 2 - setup.py | 3 + 6 files changed, 14 insertions(+), 109 deletions(-) create mode 100644 environment.yml delete mode 100644 graphreadability.yml delete mode 100644 graphreadability/tests/test_readabilitygraph.py diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..0c80350 --- /dev/null +++ b/environment.yml @@ -0,0 +1,11 @@ +name: gr-min +channels: + - conda-forge +dependencies: + - python=3.7 + - networkx + - numpy + - matplotlib + - scipy + - pandas +prefix: /home/philip/miniforge/envs/gr-min diff --git a/graphreadability.yml b/graphreadability.yml deleted file mode 100644 index ba31a01..0000000 --- a/graphreadability.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: graphreadability -channels: - - conda-forge - - defaults -dependencies: - - python=3.10 - - networkx=2 - - numpy=1.23 - - matplotlib=3.6 - - ipykernel - - ca-certificates - - certifi - - openssl - - ipympl - - scipy -prefix: /home/philip/miniconda3/envs/graphreadability diff --git a/graphreadability/tests/test_graphreadability.py b/graphreadability/tests/test_graphreadability.py index 66d1c8a..4f2c4ce 100644 --- a/graphreadability/tests/test_graphreadability.py +++ b/graphreadability/tests/test_graphreadability.py @@ -3,7 +3,6 @@ import networkx as nx import pandas as pd import matplotlib.pyplot as plt -import seaborn as sns import graphreadability as gr class TestGraphReadability(unittest.TestCase): diff --git a/graphreadability/tests/test_readabilitygraph.py b/graphreadability/tests/test_readabilitygraph.py deleted file mode 100644 index 0b73f97..0000000 --- a/graphreadability/tests/test_readabilitygraph.py +++ /dev/null @@ -1,90 +0,0 @@ -import unittest -import networkx as nx -from graphreadability import ReadabilityGraph - - -class TestReadabilityGraph(unittest.TestCase): - def setUp(self): - self.graph = ReadabilityGraph() - - def test_edge_vector(self): - self.graph.add_node("A", pos=(0, 0)) - self.graph.add_node("B", pos=(1, 1)) - vector = self.graph.edge_vector(("A", "B")) - self.assertEqual(vector.tolist(), [1, 1]) - - def test_calculate_edge_crossings(self): - self.graph.add_node("A", pos=(0, 0)) - self.graph.add_node("B", pos=(1, 1)) - self.graph.add_node("C", pos=(2, 0)) - self.graph.add_edge("A", "B") - self.graph.add_edge("B", "C") - crossings = self.graph.calculate_edge_crossings() - self.assertEqual(len(crossings), 0) - - def test_calculate_node_node_overlap(self): - self.graph.add_node("A", pos=(0, 0), size=1) - self.graph.add_node("B", pos=(2, 0), size=1) - self.graph.add_node("C", pos=(1, 0), size=1) - overlaps = self.graph.calculate_node_node_overlap() - self.assertEqual(len(overlaps), 0) - - def test_node_overlap_node(self): - self.graph.add_node("A", pos=(0, 0), size=1) - self.graph.add_node("B", pos=(1, 0), size=1) - self.graph.add_edge("A", "B") - overlap = self.graph.node_overlap_node() - self.assertEqual(overlap["A"], False) - self.assertEqual(overlap["B"], False) - - def test_edge_crossings_global(self): - self.graph.add_node("A", pos=(0, 0)) - self.graph.add_node("B", pos=(1, 1)) - self.graph.add_node("C", pos=(2, 0)) - self.graph.add_edge("A", "B") - self.graph.add_edge("B", "C") - crossings = self.graph.edge_crossings_global() - self.assertEqual(crossings, 0) - - def test_edge_crossings_edge(self): - self.graph.add_node("A", pos=(0, 0)) - self.graph.add_node("B", pos=(1, 1)) - self.graph.add_node("C", pos=(2, 0)) - self.graph.add_edge("A", "B") - self.graph.add_edge("B", "C") - crossings = self.graph.edge_crossings_edge() - self.assertEqual(crossings[("A", "B")], 0) - self.assertEqual(crossings[("B", "C")], 0) - - def test_edge_crossings_node(self): - self.graph.add_node("A", pos=(0, 0)) - self.graph.add_node("B", pos=(1, 1)) - self.graph.add_node("C", pos=(2, 0)) - self.graph.add_edge("A", "B") - self.graph.add_edge("B", "C") - crossings = self.graph.edge_crossings_node() - self.assertEqual(crossings["A"], 0) - self.assertEqual(crossings["B"], 0) - self.assertEqual(crossings["C"], 0) - - def test_edge_crossing_angles_edge(self): - self.graph.add_node("A", pos=(0, 0)) - self.graph.add_node("B", pos=(1, 1)) - self.graph.add_node("C", pos=(2, 0)) - self.graph.add_edge("A", "B") - self.graph.add_edge("B", "C") - angles = self.graph.edge_crossing_angles_edge() - self.assertEqual(len(angles), 2) - - def test_edge_crossing_angles_global(self): - self.graph.add_node("A", pos=(0, 0)) - self.graph.add_node("B", pos=(1, 1)) - self.graph.add_node("C", pos=(2, 0)) - self.graph.add_edge("A", "B") - self.graph.add_edge("B", "C") - angle = self.graph.edge_crossing_angles_global() - self.assertEqual(angle, 0) - - -if __name__ == "__main__": - unittest.main() diff --git a/graphreadability/utils/helpers.py b/graphreadability/utils/helpers.py index cbc22d8..9774961 100644 --- a/graphreadability/utils/helpers.py +++ b/graphreadability/utils/helpers.py @@ -1,8 +1,6 @@ from scipy.spatial import KDTree import numpy as np import networkx as nx -import numpy as np -import matplotlib.pyplot as plt ### MATH HELPERS ### diff --git a/setup.py b/setup.py index 610c133..fc0118e 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,9 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], python_requires=">=3.7", license="All Rights Reserved",