def test_threads(self): self.sd = simulation_objects.Simulation_Data(threads="1.5") self.assertEqual(self.sd.threads, "1") self.assertNotEqual(self.sd.threads, "1.5") self.sd = None self.sd = simulation_objects.Simulation_Data(threads=["a", "b"]) self.assertEqual(self.sd.threads, "")
def test_simc_arguments(self): self.sd = simulation_objects.Simulation_Data(simc_arguments="1") self.assertNotEqual(self.sd.simc_arguments, "1") self.assertEqual(self.sd.simc_arguments, ["1"]) self.sd = None self.sd = simulation_objects.Simulation_Data(simc_arguments=["a", "b"]) self.assertEqual(self.sd.simc_arguments, ["a", "b"])
def test_target_error(self): self.sd = simulation_objects.Simulation_Data(target_error="0.5") self.assertEqual(self.sd.target_error, "0.5") self.assertNotEqual(self.sd.target_error, ["1"]) self.sd = None self.sd = simulation_objects.Simulation_Data(target_error=["a", "b"]) self.assertEqual(self.sd.target_error, "0.1")
def test_name(self): self.sd = simulation_objects.Simulation_Data(name="") self.assertNotEqual(self.sd.name, "") self.assertEqual(type(self.sd.name), str) self.sd = None self.sd = simulation_objects.Simulation_Data(name="Borke") self.assertEqual(self.sd.name, "Borke")
def test_get_avg(self): sd = simulation_objects.Simulation_Data() sd.set_dps(100) self.sd.set_dps(50) self.assertEqual(sd.get_avg(self.sd), 75) sd_empty = simulation_objects.Simulation_Data() self.assertEqual(self.sd.get_avg(sd_empty), None)
def setUp(self): self.sd1 = simulation_objects.Simulation_Data( target_error="1.0", simc_arguments=["talents=2222222"] ) self.sd2 = simulation_objects.Simulation_Data( target_error=1.0, simc_arguments=["talents=1111111"] ) self.sg = simulation_objects.Simulation_Group([self.sd1, self.sd2])
def test_ready_trigger(self): self.sd = simulation_objects.Simulation_Data(ready_trigger="1") self.assertEqual(self.sd.ready_trigger, "1") self.assertNotEqual(self.sd.ready_trigger, "0") self.assertNotEqual(self.sd.ready_trigger, str) self.assertNotEqual(self.sd.ready_trigger, list) self.assertNotEqual(self.sd.ready_trigger, dict) self.assertNotEqual(self.sd.ready_trigger, int) self.sd = None self.sd = simulation_objects.Simulation_Data(ready_trigger=["1"]) self.assertEqual(self.sd.ready_trigger, "1")
def test_ptr(self): self.sd = simulation_objects.Simulation_Data(ptr="1") self.assertEqual(self.sd.ptr, "1") self.assertNotEqual(self.sd.ptr, "0") self.assertNotEqual(self.sd.ptr, str) self.assertNotEqual(self.sd.ptr, list) self.assertNotEqual(self.sd.ptr, dict) self.assertNotEqual(self.sd.ptr, int) self.sd = None self.sd = simulation_objects.Simulation_Data(ptr=["1"]) self.assertEqual(self.sd.ptr, "0")
def test_optimize_expressions(self): self.sd = simulation_objects.Simulation_Data(optimize_expressions="1") self.assertEqual(self.sd.optimize_expressions, "1") self.assertNotEqual(self.sd.optimize_expressions, "0") self.assertNotEqual(self.sd.optimize_expressions, str) self.assertNotEqual(self.sd.optimize_expressions, list) self.assertNotEqual(self.sd.optimize_expressions, dict) self.assertNotEqual(self.sd.optimize_expressions, int) self.sd = None self.sd = simulation_objects.Simulation_Data(optimize_expressions=["1"]) self.assertEqual(self.sd.optimize_expressions, "1")
def test_log(self): self.sd = simulation_objects.Simulation_Data(log="1") self.assertEqual(self.sd.log, "1") self.assertNotEqual(self.sd.log, "") self.assertNotEqual(self.sd.log, str) self.assertNotEqual(self.sd.log, list) self.assertNotEqual(self.sd.log, dict) self.assertNotEqual(self.sd.log, int) self.sd = None self.sd = simulation_objects.Simulation_Data(iterations=15000) self.assertEqual(self.sd.log, "0")
def test_iterations(self): self.sd = simulation_objects.Simulation_Data(iterations="15000") self.assertEqual(self.sd.iterations, "15000") self.assertNotEqual(self.sd.iterations, "") self.assertNotEqual(self.sd.iterations, str) self.assertNotEqual(self.sd.iterations, list) self.assertNotEqual(self.sd.iterations, dict) self.assertNotEqual(self.sd.iterations, int) self.sd = None self.sd = simulation_objects.Simulation_Data(iterations=15000) self.assertEqual(self.sd.iterations, "15000") self.sd = None self.sd = simulation_objects.Simulation_Data(iterations=15000.75) self.assertEqual(self.sd.iterations, "15000")
def test_add(self): start = len(self.sg.profiles) new_data = simulation_objects.Simulation_Data(target_error=1.0) self.assertTrue(self.sg.add(new_data)) self.assertEqual(len(self.sg.profiles), start + 1) with self.assertRaises(TypeError): self.sg.add("Bananana")
def test_empty(self): """Test all available and left empty input values for their correct default values. """ self.sd = simulation_objects.Simulation_Data() self.assertEqual(self.sd.calculate_scale_factors, "0") self.assertEqual(self.sd.default_actions, "1") self.assertEqual(self.sd.default_skill, "1.0") self.assertEqual(self.sd.fight_style, "patchwerk") self.assertEqual(self.sd.fixed_time, "1") self.assertEqual(self.sd.html, "") self.assertEqual(self.sd.iterations, "250000") self.assertEqual(self.sd.log, "0") self.assertNotEqual(self.sd.name, None) self.assertEqual(self.sd.optimize_expressions, "1") self.assertEqual(self.sd.ptr, "0") self.assertEqual(self.sd.ready_trigger, "1") self.assertEqual(self.sd.simc_arguments, []) self.assertEqual(self.sd.target_error, "0.1") self.assertEqual(self.sd.threads, "") self.assertEqual(type(self.sd.so_creation_time), datetime.datetime) self.assertEqual(self.sd.external_simulation, False) self.assertEqual(self.sd.full_report, None) self.assertEqual(self.sd.so_simulation_end_time, None) self.assertEqual(self.sd.so_simulation_start_time, None)
def test_fixed_time(self): self.sd = simulation_objects.Simulation_Data(fixed_time="1") self.assertEqual(self.sd.fixed_time, "1") self.assertNotEqual(self.sd.fixed_time, "0") self.assertNotEqual(self.sd.fixed_time, str) self.assertNotEqual(self.sd.fixed_time, list) self.assertNotEqual(self.sd.fixed_time, dict) self.assertNotEqual(self.sd.fixed_time, int)
def test_html(self): self.sd = simulation_objects.Simulation_Data(html="testiger.html") self.assertEqual(self.sd.html, "testiger.html") self.assertNotEqual(self.sd.html, "") self.assertNotEqual(self.sd.html, str) self.assertNotEqual(self.sd.html, list) self.assertNotEqual(self.sd.html, dict) self.assertNotEqual(self.sd.html, int)
def test_default_actions(self): self.sd = simulation_objects.Simulation_Data(default_actions="1") self.assertEqual(self.sd.default_actions, "1") self.assertNotEqual(self.sd.default_actions, "0") self.assertNotEqual(self.sd.default_actions, str) self.assertNotEqual(self.sd.default_actions, list) self.assertNotEqual(self.sd.default_actions, dict) self.assertNotEqual(self.sd.default_actions, int)
def test_fight_style(self): self.sd = simulation_objects.Simulation_Data(fight_style="helterskelter") self.assertEqual(self.sd.fight_style, "helterskelter") self.assertNotEqual(self.sd.fight_style, "0") self.assertNotEqual(self.sd.fight_style, str) self.assertNotEqual(self.sd.fight_style, list) self.assertNotEqual(self.sd.fight_style, dict) self.assertNotEqual(self.sd.fight_style, int)
def test_wrong_list_input(self): tmp = simulation_objects.Simulation_Data(iterations="5000") with self.assertRaises(ValueError): simulation_objects.Simulation_Group([self.sd1, tmp]) with self.assertRaises(TypeError): simulation_objects.Simulation_Group([ "why", "would", "anyone", "do", "this" ])
def test_calculate_scale_factors(self): """Test input checks of calculate_scale_factors. """ self.sd = simulation_objects.Simulation_Data(calculate_scale_factors="1") self.assertEqual(self.sd.calculate_scale_factors, "1") self.assertNotEqual(self.sd.calculate_scale_factors, "0") self.assertNotEqual(self.sd.calculate_scale_factors, str) self.assertNotEqual(self.sd.calculate_scale_factors, list) self.assertNotEqual(self.sd.calculate_scale_factors, dict) self.assertNotEqual(self.sd.calculate_scale_factors, int)
def test_set_dps(self): self.assertEqual(self.sd.set_dps("123"), None) self.assertEqual(self.sd.dps, 123) with self.assertRaises(simulation_objects.AlreadySetError): self.sd.set_dps(5678.9) with self.assertRaises(TypeError): self.sd.set_dps("5678", external="Hallo") self.sd = None self.sd = simulation_objects.Simulation_Data() with self.assertRaises(TypeError): self.sd.set_dps("Bonjour", external="Bonsoir") self.assertEqual(self.sd.get_dps(), None) with self.assertRaises(ValueError): self.sd.set_dps("Bonjour", external=False) self.assertEqual(self.sd.get_dps(), None)
def test_is_equal(self): sd1 = self.sd sd2 = simulation_objects.Simulation_Data() self.assertTrue(sd1.is_equal(sd2)) self.assertTrue(sd2.is_equal(sd1)) self.assertTrue(sd1.is_equal(sd1)) self.assertFalse(sd1.is_equal("Döner")) sd_calculate_scale_factors = simulation_objects.Simulation_Data( calculate_scale_factors="1" ) self.assertFalse(sd_calculate_scale_factors.is_equal(sd1)) sd_default_actions = simulation_objects.Simulation_Data( default_actions="0" ) self.assertFalse(sd_default_actions.is_equal(sd1)) sd_default_skill = simulation_objects.Simulation_Data(default_skill="0.5") self.assertFalse(sd_default_skill.is_equal(sd1)) sd_executable = simulation_objects.Simulation_Data(executable="1") self.assertFalse(sd_executable.is_equal(sd1)) sd_fight_style = simulation_objects.Simulation_Data( fight_style="helterskelter" ) self.assertFalse(sd_fight_style.is_equal(sd1)) sd_fixed_time = simulation_objects.Simulation_Data(fixed_time="0") self.assertFalse(sd_fixed_time.is_equal(sd1)) sd_html = simulation_objects.Simulation_Data(html="test.html") self.assertFalse(sd_html.is_equal(sd1)) sd_iterations = simulation_objects.Simulation_Data(iterations="124153") self.assertFalse(sd_iterations.is_equal(sd1)) sd_log = simulation_objects.Simulation_Data(log="1") self.assertFalse(sd_log.is_equal(sd1)) sd_optimize_expressions = simulation_objects.Simulation_Data( optimize_expressions="0" ) self.assertFalse(sd_optimize_expressions.is_equal(sd1)) sd_ptr = simulation_objects.Simulation_Data(ptr="1") self.assertFalse(sd_ptr.is_equal(sd1)) sd_ready_trigger = simulation_objects.Simulation_Data(ready_trigger="0") self.assertFalse(sd_ready_trigger.is_equal(sd1)) sd_target_error = simulation_objects.Simulation_Data(target_error="0.5") self.assertFalse(sd_target_error.is_equal(sd1)) sd_threads = simulation_objects.Simulation_Data(threads="4") self.assertFalse(sd_threads.is_equal(sd1))
def setUp(self): self.sd1 = simulation_objects.Simulation_Data() self.sd2 = simulation_objects.Simulation_Data()