def test_visualise_si_nodes_edges(self) -> None:
     """Checks if visualisation is being generated."""
     FlatSpreading.visualise_si_nodes_edges(self.exp_M, self.nodes_infected,
                                            self.par, self.out_dir)
     vis_si_nodes_edges_name = f"{self.exp_name}_si_ne.gif"
     self.assertTrue(
         vis_si_nodes_edges_name in os.listdir(self.out_dir),
         f"After creating visualisation a gif file of name "
         f"{vis_si_nodes_edges_name} should be saved!",
     )
     shutil.rmtree(self.out_dir)
 def test_compare_high_beta(self) -> None:
     """Checks if change of beta parameter changes duration of simulat."""
     beta = 1
     comp_out_vals = FlatSpreading.si_diffusion(self.exp_M, self.exp_I,
                                                beta)
     self.assertGreater(
         len(self.list_S),
         len(comp_out_vals[0]),
         f"Simulation logs for beta={beta} should be greater than for beta"
         f"={self.exp_beta} ({len(self.list_S)}!>{len(comp_out_vals[0])})",
     )
 def test_compare_high_I(self) -> None:
     """Checks if change of I parameter changes duration of simulation."""
     new_exp_I = 1
     comp_out_vals = FlatSpreading.si_diffusion(self.exp_M, new_exp_I,
                                                self.exp_beta)
     for i in comp_out_vals[:-1]:
         self.assertEqual(
             len(i),  # type: ignore
             1,
             f"Simulation logs for I={new_exp_I} should be "
             f"equal to 1 (len({i})!=1)",
         )
    def setUp(self) -> None:
        """Sets up testing parameters and performs simulation."""
        self.exp_M = nx.les_miserables_graph()
        self.exp_beta = 0.1
        self.exp_I = 0.05
        self.exp_name = "".join(random.choices(string.ascii_letters, k=5))
        self.out_dir = "".join(random.choices(string.ascii_letters, k=5))

        (
            self.list_S,
            self.list_I,
            self.list_iter,
            self.nodes_infected,
            self.par,
        ) = FlatSpreading.si_diffusion(self.exp_M,
                                       self.exp_I,
                                       self.exp_beta,
                                       name=self.exp_name)