def test_serial_fingerprint(self): strategy = axl.TitForTat() tf = TransitiveFingerprint(strategy) tf.fingerprint(repetitions=1, progress_bar=False, filename="test_outputs/tran_fin.csv") self.assertEqual(tf.data.shape, (50, 50))
def test_serial_fingerprint(self): strategy = axl.TitForTat() tf = TransitiveFingerprint(strategy) tf.fingerprint( repetitions=1, progress_bar=False, filename="test_outputs/tran_fin.csv" ) self.assertEqual(tf.data.shape, (50, 50))
def test_fingerprint_with_filename(self): filename = "test_outputs/test_fingerprint.csv" strategy = axl.TitForTat() tf = TransitiveFingerprint(strategy) tf.fingerprint(turns=1, repetitions=1, progress_bar=False, filename=filename) with open(filename, "r") as out: data = out.read() self.assertEqual(len(data.split("\n")), 102)
def test_fingerprint_with_filename(self): path = pathlib.Path("test_outputs/test_fingerprint.csv") filename = axl_filename(path) strategy = axl.TitForTat() tf = TransitiveFingerprint(strategy) tf.fingerprint(turns=1, repetitions=1, progress_bar=False, filename=filename) with open(filename, "r") as out: data = out.read() self.assertEqual(len(data.split("\n")), 102)
def test_fingerprint_with_filename(self): filename = "test_outputs/test_fingerprint.csv" strategy = axl.TitForTat() tf = TransitiveFingerprint(strategy) tf.fingerprint(turns=1, repetitions=1, progress_bar=False, filename=filename) with open(filename, 'r') as out: data = out.read() self.assertEqual(len(data.split("\n")), 50 + 1)
def test_plot(self): """ Test that plot is created with various arguments. """ tf = TransitiveFingerprint(axl.TitForTat) tf.fingerprint(turns=10, repetitions=2, progress_bar=False) p = tf.plot() self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(cmap="jet") self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(interpolation="bicubic") self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(title="Title") self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(colorbar=False) self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(labels=False) self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(display_names=True) self.assertIsInstance(p, matplotlib.pyplot.Figure)
def test_plot(self): """ Test that plot is created with various arguments. """ tf = TransitiveFingerprint(axl.TitForTat) tf.fingerprint(turns=10, repetitions=2, progress_bar=False) p = tf.plot() self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(cmap="jet") self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(interpolation="bicubic") self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(title="Title") self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(colorbar=False) self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(labels=False) self.assertIsInstance(p, matplotlib.pyplot.Figure) p = tf.plot(display_names=True) self.assertIsInstance(p, matplotlib.pyplot.Figure)
def test_plot_with_axis(self): fig, axarr = matplotlib.pyplot.subplots(2, 2) tf = TransitiveFingerprint(axl.TitForTat) tf.fingerprint(turns=10, repetitions=2, progress_bar=False) p = tf.plot(ax=axarr[0, 0]) self.assertIsInstance(p, matplotlib.pyplot.Figure)
def test_parallel_fingerprint(self): strategy = axl.TitForTat() tf = TransitiveFingerprint(strategy) tf.fingerprint(repetitions=1, progress_bar=False, processes=2) self.assertEqual(tf.data.shape, (50, 50))
def test_plot_with_axis(self): fig, axarr = matplotlib.pyplot.subplots(2, 2) tf = TransitiveFingerprint(axl.TitForTat) tf.fingerprint(turns=10, repetitions=2, progress_bar=False) p = tf.plot(ax=axarr[0, 0]) self.assertIsInstance(p, matplotlib.pyplot.Figure)
def test_parallel_fingerprint(self): strategy = axl.TitForTat() tf = TransitiveFingerprint(strategy) tf.fingerprint(repetitions=1, progress_bar=False, processes=2) self.assertEqual(tf.data.shape, (50, 50))