~ubuntu-branches/ubuntu/trusty/bioperl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/RemoteDB/EMBL.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*-Perl-*- Test Harness script for Bioperl
 
2
# $Id: EMBL.t 15418 2009-01-21 17:10:34Z cjfields $
 
3
 
 
4
use strict;
 
5
 
 
6
BEGIN { 
 
7
    use lib '.';
 
8
        use Bio::Root::Test;
 
9
        
 
10
        test_begin(-tests => 16,
 
11
                           -requires_modules => [qw(IO::String HTTP::Request::Common)],
 
12
                           -requires_networking => 1);
 
13
        
 
14
        use_ok('Bio::DB::EMBL');
 
15
}
 
16
 
 
17
my $verbose = test_debug();
 
18
 
 
19
my ($db,$seq,$seqio);
 
20
# get a single seq
 
21
 
 
22
$seq = $seqio = undef;
 
23
 
 
24
SKIP: { 
 
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'));
 
29
        
 
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
    cmp_ok( $seq->length, '>=', 200);
 
41
}
 
42
 
 
43
$seq = $seqio = undef;
 
44
 
 
45
SKIP: {
 
46
    $db = Bio::DB::EMBL->new(-verbose => $verbose,
 
47
                            -retrievaltype => 'tempfile',
 
48
                            -format => 'fasta'
 
49
                            ); 
 
50
    eval{ok( defined($seqio = $db->get_Stream_by_acc(['J00522 AF303112 J02231'])))};
 
51
        skip('could not connect to embl',3) if $@;
 
52
    my %seqs;
 
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;
 
57
    }
 
58
    is($seqs{'J00522'},408);
 
59
    is($seqs{'AF303112'},1611);
 
60
    is($seqs{'J02231'},200);
 
61
}