コード例 #1
0
 def test_disconnect(self):
     """disconnect breaks all connections and allows parts to be reused"""
     aseqfunc1 = ComposableSeq(input_types="sequences",
                               output_types="sequences")
     aseqfunc2 = ComposableSeq(input_types="sequences",
                               output_types="sequences")
     aseqfunc3 = ComposableSeq(input_types="sequences",
                               output_types="sequences")
     comb = aseqfunc1 + aseqfunc2 + aseqfunc3
     comb.disconnect()
     self.assertEqual(aseqfunc1.input, None)
     self.assertEqual(aseqfunc1.output, None)
     self.assertEqual(aseqfunc3.input, None)
     self.assertEqual(aseqfunc3.output, None)
     # should be able to compose a new one now
     comb2 = aseqfunc1 + aseqfunc3
コード例 #2
0
 def test_composables_once(self):
     """composables can only be used in a single composition"""
     aseqfunc1 = ComposableSeq(input_types="sequences",
                               output_types="sequences")
     aseqfunc2 = ComposableSeq(input_types="sequences",
                               output_types="sequences")
     comb = aseqfunc1 + aseqfunc2
     with self.assertRaises(AssertionError):
         aseqfunc3 = ComposableSeq(input_types="sequences",
                                   output_types="sequences")
         comb2 = aseqfunc1 + aseqfunc3
     # the other order
     with self.assertRaises(AssertionError):
         aseqfunc3 = ComposableSeq(input_types="sequences",
                                   output_types="sequences")
         comb2 = aseqfunc3 + aseqfunc2
コード例 #3
0
ファイル: test_composable.py プロジェクト: tla256/cogent3
 def test_composable_to_self(self):
     """this should raise a ValueError"""
     app1 = ComposableSeq(input_types="sequences", output_types="sequences")
     with self.assertRaises(ValueError):
         _ = app1 + app1