1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 16,
11 -requires_modules => [qw(IO::String HTTP::Request::Common)],
12 -requires_networking => 1);
14 use_ok('Bio::DB::EMBL');
17 my $verbose = test_debug();
22 $seq = $seqio = undef;
25 ok defined($db = Bio::DB::EMBL->new(-verbose=>$verbose));
26 ok(defined($seq = $db->get_Seq_by_acc('J00522')));
27 is( $seq->length, 408);
28 ok defined ($db->request_format('fasta'));
30 eval {ok(defined($seq = $db->get_Seq_by_acc('J02231')))};
31 skip('could not connect to embl',2) if $@;
32 is( $seq->id, 'embl|J02231|J02231');
33 is( $seq->length, 200);
34 ok( defined($db = Bio::DB::EMBL->new(-verbose=>$verbose,
35 -retrievaltype => 'tempfile')));
36 eval {ok(defined($seqio = $db->get_Stream_by_id(['BUM'])))};
37 skip('could not connect to embl',2) if $@;
38 undef $db; # testing to see if we can remove gb
39 ok( defined($seq = $seqio->next_seq()));
40 is( $seq->length, 200);
43 $seq = $seqio = undef;
46 $db = Bio::DB::EMBL->new(-verbose => $verbose,
47 -retrievaltype => 'tempfile',
50 eval{ok( defined($seqio = $db->get_Stream_by_acc(['J00522 AF303112 J02231'])))};
51 skip('could not connect to embl',3) if $@;
53 # don't assume anything about the order of the sequences
54 while ( my $s = $seqio->next_seq ) {
55 my ($type,$x,$name) = split(/\|/,$s->display_id);
56 $seqs{$x} = $s->length;
58 is($seqs{'J00522'},408);
59 is($seqs{'AF303112'},1611);
60 is($seqs{'J02231'},200);