Catch failing tie'd DB_File handle
[bioperl-live.git] / t / tinyseq.t
blobc9c3bab50283a43ed567e410d3ace86f7d332071
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7     use lib 't/lib';
8     use BioperlTest;
9     
10     test_begin(-tests => 16,
11                            -requires_modules => [qw(XML::Parser::PerlSAX XML::Writer)]);
12         
13         use_ok('Bio::SeqIO');
16 my $file = test_input_file('NM_002253.tseq');
17 my $outfile = test_output_file();
19 my $instream = Bio::SeqIO->new( -file           => $file,
20                                 -format         => 'tinyseq' );
22 my $outstream = Bio::SeqIO->new( -file          => ">$outfile",
23                                  -format        => 'tinyseq' );
25 my $seq = $instream->next_seq;
26 ok(defined $seq);
27 ok(defined $seq->seq);
28 is($seq->length, 5830);
29 is($seq->accession_number,'NM_002253');
30 ok($seq->species);
31 is($seq->species->binomial, 'Homo sapiens');
32 is($seq->species->ncbi_taxid, 9606);   
33 $outstream->write_seq($seq);
34 undef $outstream;
36 ok(-s $outfile);
38 my $reread = Bio::SeqIO->new( -file             => $outfile,
39                               -format           => 'tinyseq' );
41 my $seq2 = $reread->next_seq;
43 ok($seq2);
44 ok($seq2->seq);
45 is($seq2->length, 5830);
46 is($seq2->accession_number, 'NM_002253');
47 ok($seq2->species);
48 is($seq2->species->binomial, 'Homo sapiens');
49 is($seq2->species->ncbi_taxid, 9606);