File: SeqRead_fail.t

package info (click to toggle)
bioperl 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 40,768 kB
  • ctags: 12,005
  • sloc: perl: 174,299; xml: 13,923; sh: 1,941; lisp: 1,803; asm: 109; makefile: 53
file content (48 lines) | stat: -rw-r--r-- 1,222 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*-Perl-*- Test Harness script for Bioperl
# $Id: SeqRead_fail.t 15407 2009-01-20 05:18:29Z cjfields $

use strict;

BEGIN { 
	use lib '.';
    use Bio::Root::Test;
    
    test_begin(-tests => 18,
			   -requires_modules => [qw(IO::String
									    LWP::UserAgent
										HTTP::Request::Common)],
			   -requires_networking => 1);
	
	use_ok('Bio::DB::GenBank');
	use_ok('Bio::DB::GenPept');
	use_ok('Bio::DB::SwissProt');
	use_ok('Bio::DB::RefSeq');
	use_ok('Bio::DB::EMBL');
	use_ok('Bio::DB::BioFetch');
}

my $verbose = test_debug();

sub fetch {
    my ($id, $class) = @_;
    print "###################### $class  ####################################\n" if $verbose;
    my $seq;
    ok defined( my $gb = $class->new('-verbose'=>$verbose,
									 '-delay'=>0,
									 '-retrievaltype' => 'tempfile') ), "defined for $class";
    eval { $seq = $gb->get_Seq_by_id($id) };
    if ($@ || !defined $seq) {
		ok 1, "error or undef for $class";
		return;
    }
    ok 0, "failure for $class";
}

my @classes = qw( Bio::DB::BioFetch Bio::DB::GenBank Bio::DB::GenPept
                  Bio::DB::SwissProt Bio::DB::RefSeq Bio::DB::EMBL );

my $id = 'XXX111';  # nonsense id

for (@classes) {
    fetch($id, $_);
}