Esempio n. 1
0
    def test_init(self):
        self.assertRaises(TypeError, _tsinfer.TreeSequenceBuilder)
        for bad_array in [None, "serf", [[], []], ["asdf"], {}]:
            with self.assertRaises(ValueError):
                _tsinfer.TreeSequenceBuilder(bad_array)

        for bad_type in [None, "sdf", {}]:
            with self.assertRaises(TypeError):
                _tsinfer.TreeSequenceBuilder([2], max_nodes=bad_type)
            with self.assertRaises(TypeError):
                _tsinfer.TreeSequenceBuilder([2], max_edges=bad_type)
Esempio n. 2
0
 def test_init(self):
     with pytest.raises(TypeError):
         _tsinfer.AncestorMatcher()
     with pytest.raises(TypeError):
         _tsinfer.AncestorMatcher(None)
     tsb = _tsinfer.TreeSequenceBuilder([2])
     with pytest.raises(TypeError):
         _tsinfer.AncestorMatcher(tsb)
     with pytest.raises(TypeError):
         _tsinfer.AncestorMatcher(tsb, [1])
     for bad_type in [None, {}]:
         with pytest.raises(TypeError):
             _tsinfer.AncestorMatcher(
                 tsb,
                 [1],
                 [1],
                 extended_checks=bad_type,
             )
         with pytest.raises(TypeError):
             _tsinfer.AncestorMatcher(tsb, [1], [1], precision=bad_type)
     for bad_array in [[], [[], []], None, "sdf", [1, 2, 3]]:
         with pytest.raises(ValueError):
             _tsinfer.AncestorMatcher(tsb, bad_array, [1])
         with pytest.raises(ValueError):
             _tsinfer.AncestorMatcher(tsb, [1], bad_array)
Esempio n. 3
0
 def test_tree_sequence_builder_too_many_edges(self):
     big = 2**62
     with pytest.raises(MemoryError):
         _tsinfer.TreeSequenceBuilder([2], max_edges=big)