~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to t/Scansite.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
 
# This is -*-Perl-*- code
2
 
## Bioperl Test Harness Script for Modules
3
 
##
4
 
# $Id: Scansite.t,v 1.1 2003/11/18 
5
 
# Before `make install' is performed this script should be runnable with
6
 
# `make test'. After `make install' it should work as `perl test.t'
7
 
 
8
 
use strict;
9
 
use vars qw($NUMTESTS $DEBUG $ERROR);
10
 
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
11
 
BEGIN {
12
 
        # to handle systems with no installed Test module
13
 
        # we include the t dir (where a copy of Test.pm is located)
14
 
        # as a fallback
15
 
        eval { require Test; };
16
 
        $ERROR = 0;
17
 
        if( $@ ) {
18
 
                use lib 't';
19
 
        }
20
 
        use Test;
21
 
 
22
 
        $NUMTESTS = 12;
23
 
        plan tests => $NUMTESTS;
24
 
 
25
 
        eval {
26
 
                require IO::String; 
27
 
                require LWP::UserAgent;
28
 
        };
29
 
        if( $@ ) {
30
 
                warn("IO::String or LWP::UserAgent not installed. This means that the module is not usable. Skipping tests");
31
 
                $ERROR = 1;
32
 
        }
33
 
}
34
 
 
35
 
END {
36
 
        if ($DEBUG) {
37
 
                foreach ( $Test::ntest..$NUMTESTS) {
38
 
                        skip('unable to run all of the Scansite tests',1);
39
 
                }
40
 
        } else {
41
 
                foreach ( $Test::ntest..$NUMTESTS) {
42
 
                        skip('set env BIOPERLDEBUG to run tests over web',1);
43
 
                }
44
 
        }
45
 
}
46
 
 
47
 
exit 0 if $ERROR ==  1;
48
 
 
49
 
use Data::Dumper;
50
 
 
51
 
require Bio::Tools::Analysis::Protein::Scansite;
52
 
use Bio::SeqIO;
53
 
use Bio::PrimarySeq;
54
 
require Bio::WebAgent;
55
 
 
56
 
ok 1;
57
 
 
58
 
my $verbose = 0;
59
 
$verbose = 1 if $DEBUG;
60
 
 
61
 
ok my $tool = Bio::WebAgent->new(-verbose =>$verbose);
62
 
 
63
 
 
64
 
my $seqio=new Bio::SeqIO( -verbose => $verbose,
65
 
                  -format => 'swiss',
66
 
                  -file   => Bio::Root::IO->catfile('t','data', 'swiss.dat'));
67
 
 
68
 
my $seq = $seqio->next_seq();
69
 
ok $tool = Bio::Tools::Analysis::Protein::Scansite->new( 
70
 
                                        -seq=>$seq->primary_seq);
71
 
ok $tool->stringency('Low');
72
 
ok $tool->stringency(), 'Low';
73
 
ok $tool->protein_id(), $tool->seq->display_id();
74
 
exit unless $DEBUG;
75
 
ok $tool->run ();
76
 
exit if $tool->status eq 'TERMINATED_BY_ERROR';
77
 
ok my $raw = $tool->result('');
78
 
print $raw if $verbose;
79
 
ok my $parsed = $tool->result('parsed');
80
 
ok $parsed->[0]{'site'}, 'T101';
81
 
ok my @res = $tool->result('Bio::SeqFeatureI');
82
 
ok $res[0]->start, 101;