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

« back to all changes in this revision

Viewing changes to t/Phenotype/Phenotype.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: Phenotype.t 15112 2008-12-08 18:12:38Z sendu $
 
3
 
 
4
use strict;
 
5
 
 
6
BEGIN {
 
7
    use lib '.';
 
8
    use Bio::Root::Test;
 
9
    
 
10
    test_begin(-tests => 116);
 
11
        
 
12
    use_ok('Bio::Phenotype::Phenotype');
 
13
    use_ok('Bio::Species');
 
14
    use_ok('Bio::Annotation::Reference');
 
15
    use_ok('Bio::Map::CytoPosition');
 
16
    use_ok('Bio::Phenotype::Correlate');
 
17
    use_ok('Bio::Phenotype::Measure');
 
18
    use_ok('Bio::Annotation::DBLink');
 
19
}
 
20
 
 
21
my $obj = Bio::Phenotype::Phenotype->new();
 
22
 
 
23
isa_ok( $obj, "Bio::Phenotype::PhenotypeI" );
 
24
isa_ok( $obj, "Bio::Phenotype::Phenotype" );
 
25
 
 
26
ok( $obj->name( "r1" ) );
 
27
is( $obj->name(), "r1" );
 
28
 
 
29
ok( $obj->description( "This is ..." ) );
 
30
is( $obj->description(), "This is ..." );
 
31
 
 
32
my $mouse = Bio::Species->new();
 
33
$mouse->classification( qw( musculus Mus ) );
 
34
ok( $obj->species( $mouse ) );
 
35
is( $obj->species()->binomial(), "Mus musculus" );
 
36
 
 
37
ok( $obj->comment( "putative" ) );
 
38
is( $obj->comment(), "putative" );
 
39
 
 
40
 
 
41
 
 
42
is( $obj->each_gene_symbol(), 0 );
 
43
 
 
44
ok( $obj->add_gene_symbols( ( "A", "B" ) ) );
 
45
is( $obj->each_gene_symbol(), 2 );
 
46
my @gs = $obj->each_gene_symbol();
 
47
is( $gs[ 0 ], "A" );
 
48
is( $gs[ 1 ], "B" );
 
49
is( $obj->each_gene_symbol(), 2 );
 
50
 
 
51
my @gs2 = $obj->remove_gene_symbols();
 
52
is( $gs2[ 0 ], "A" );
 
53
is( $gs2[ 1 ], "B" );
 
54
 
 
55
is( $obj->each_gene_symbol(), 0 );
 
56
is( $obj->remove_gene_symbols(), 0 );
 
57
 
 
58
 
 
59
 
 
60
my $v1 = Bio::Variation::VariantI->new();
 
61
my $v2 = Bio::Variation::VariantI->new();
 
62
 
 
63
$v1->length( "123" );
 
64
 
 
65
is( $obj->each_Variant(), 0 );
 
66
 
 
67
ok( $obj->add_Variants( ( $v1, $v2 ) ) );
 
68
is( $obj->each_Variant(), 2 );
 
69
my @vs = $obj->each_Variant();
 
70
is( $vs[ 0 ], $v1 );
 
71
is( $vs[ 1 ], $v2 );
 
72
is( $vs[ 0 ]->length(), "123" );
 
73
is( $obj->each_Variant(), 2 );
 
74
 
 
75
my @vs2 = $obj->remove_Variants();
 
76
is( $vs2[ 0 ], $v1 );
 
77
is( $vs2[ 1 ], $v2 );
 
78
 
 
79
is( $obj->each_Variant(), 0 );
 
80
is( $obj->remove_Variants(), 0 );
 
81
 
 
82
 
 
83
 
 
84
 
 
85
my $r1 = Bio::Annotation::Reference->new();
 
86
my $r2 = Bio::Annotation::Reference->new();
 
87
 
 
88
$r1->title( "title" );
 
89
 
 
90
is( $obj->each_Reference(), 0 );
 
91
 
 
92
ok( $obj->add_References( ( $r1, $r2 ) ) );
 
93
is( $obj->each_Reference(), 2 );
 
94
my @rs = $obj->each_Reference();
 
95
is( $rs[ 0 ]->display_text, $r1->display_text,'operator overloading in AnnotationI is deprecated');
 
96
is( $rs[ 1 ]->display_text, $r2->display_text,'operator overloading in AnnotationI is deprecated');
 
97
is( $rs[ 0 ]->title(), "title" );
 
98
is( $obj->each_Reference(), 2 );
 
99
 
 
100
my @rs2 = $obj->remove_References();
 
101
is( $rs2[ 0 ]->display_text, $r1->display_text,'operator overloading in AnnotationI is deprecated');
 
102
is( $rs2[ 1 ]->display_text, $r2->display_text,'operator overloading in AnnotationI is deprecated');
 
103
 
 
104
is( $obj->each_Reference(), 0 );
 
105
is( $obj->remove_References(), 0 );
 
106
 
 
107
 
 
108
 
 
109
 
 
110
my $c1 = Bio::Map::CytoPosition->new();
 
111
my $c2 = Bio::Map::CytoPosition->new();
 
112
 
 
113
$c1->chr( "12" );
 
114
 
 
115
is( $obj->each_CytoPosition(), 0 );
 
116
 
 
117
ok( $obj->add_CytoPositions( ( $c1, $c2 ) ) );
 
118
is( $obj->each_CytoPosition(), 2 );
 
119
my @cs = $obj->each_CytoPosition();
 
120
is( $cs[ 0 ], $c1 );
 
121
is( $cs[ 1 ], $c2 );
 
122
is( $cs[ 0 ]->chr(), 12 );
 
123
is( $obj->each_CytoPosition(), 2 );
 
124
 
 
125
my @cs2 = $obj->remove_CytoPositions();
 
126
is( $cs2[ 0 ], $c1 );
 
127
is( $cs2[ 1 ], $c2 );
 
128
 
 
129
is( $obj->each_CytoPosition(), 0 );
 
130
is( $obj->remove_CytoPositions(), 0 );
 
131
 
 
132
 
 
133
 
 
134
 
 
135
my $co1 = Bio::Phenotype::Correlate->new();
 
136
my $co2 = Bio::Phenotype::Correlate->new();
 
137
 
 
138
ok( $co1->name( "name" ) );
 
139
 
 
140
is( $obj->each_Correlate(), 0 );
 
141
 
 
142
ok( $obj->add_Correlates( ( $co1, $co2 ) ) );
 
143
is( $obj->each_Correlate(), 2 );
 
144
my @cos = $obj->each_Correlate();
 
145
is( $cos[ 0 ], $co1 );
 
146
is( $cos[ 1 ], $co2 );
 
147
is( $cos[ 0 ]->name, "name" );
 
148
is( $obj->each_Correlate(), 2 );
 
149
 
 
150
my @cos2 = $obj->remove_Correlates();
 
151
is( $cos2[ 0 ], $co1 );
 
152
is( $cos2[ 1 ], $co2 );
 
153
 
 
154
is( $obj->each_Correlate(), 0 );
 
155
is( $obj->remove_Correlates(), 0 );
 
156
 
 
157
 
 
158
 
 
159
 
 
160
my $m1 = Bio::Phenotype::Measure->new();
 
161
my $m2 = Bio::Phenotype::Measure->new();
 
162
 
 
163
ok( $m1->description( "desc" ) );
 
164
 
 
165
is( $obj->each_Measure(), 0 );
 
166
 
 
167
ok( $obj->add_Measures( ( $m1, $m2 ) ) );
 
168
is( $obj->each_Measure(), 2 );
 
169
my @ms = $obj->each_Measure();
 
170
is( $ms[ 0 ], $m1 );
 
171
is( $ms[ 1 ], $m2 );
 
172
is( $ms[ 0 ]->description, "desc" );
 
173
is( $obj->each_Measure(), 2 );
 
174
 
 
175
my @ms2 = $obj->remove_Measures();
 
176
is( $ms2[ 0 ], $m1 );
 
177
is( $ms2[ 1 ], $m2 );
 
178
 
 
179
is( $obj->each_Measure(), 0 );
 
180
is( $obj->remove_Measures(), 0 );
 
181
 
 
182
 
 
183
 
 
184
is( $obj->each_keyword(), 0 );
 
185
 
 
186
ok( $obj->add_keywords( ( "A", "B" ) ) );
 
187
is( $obj->each_keyword(), 2 );
 
188
my @ks = $obj->each_keyword();
 
189
is( $ks[ 0 ], "A" );
 
190
is( $ks[ 1 ], "B" );
 
191
is( $obj->each_keyword(), 2 );
 
192
 
 
193
my @ks2 = $obj->remove_keywords();
 
194
is( $ks2[ 0 ], "A" );
 
195
is( $ks2[ 1 ], "B" );
 
196
 
 
197
is( $obj->each_keyword(), 0 );
 
198
is( $obj->remove_keywords(), 0 );
 
199
 
 
200
 
 
201
 
 
202
my $l1 = Bio::Annotation::DBLink->new();
 
203
my $l2 = Bio::Annotation::DBLink->new();
 
204
 
 
205
ok( $l1->comment( "comment" ) );
 
206
 
 
207
is( $obj->each_DBLink(), 0 );
 
208
 
 
209
ok( $obj->add_DBLinks( ( $l1, $l2 ) ) );
 
210
is( $obj->each_DBLink(), 2 );
 
211
my @ls = $obj->each_DBLink();
 
212
is( $ls[ 0 ]->display_text, $l1->display_text,'operator overloading in AnnotationI is deprecated');
 
213
is( $ls[ 1 ]->display_text, $l2->display_text,'operator overloading in AnnotationI is deprecated');
 
214
is( $ls[ 0 ]->comment(), "comment" );
 
215
is( $obj->each_DBLink(), 2 );
 
216
 
 
217
my @ls2 = $obj->remove_DBLinks();
 
218
is( $ls2[ 0 ]->display_text, $l1->display_text,'operator overloading in AnnotationI is deprecated');
 
219
is( $ls2[ 1 ]->display_text, $l2->display_text,'operator overloading in AnnotationI is deprecated');
 
220
 
 
221
is( $obj->each_DBLink(), 0 );
 
222
is( $obj->remove_DBLinks(), 0 );
 
223
 
 
224
 
 
225
 
 
226
is( $obj->each_Genotype(), 0 );
 
227
 
 
228
ok( $obj->add_Genotypes( ( "A", "B" ) ) );
 
229
is( $obj->each_Genotype(), 2 );
 
230
my @gts = $obj->each_Genotype();
 
231
is( $gts[ 0 ], "A" );
 
232
is( $gts[ 1 ], "B" );
 
233
is( $obj->each_Genotype(), 2 );
 
234
 
 
235
my @gts2 = $obj->remove_Genotypes();
 
236
is( $gts2[ 0 ], "A" );
 
237
is( $gts2[ 1 ], "B" );
 
238
 
 
239
is( $obj->each_Genotype(), 0 );
 
240
is( $obj->remove_Genotypes(), 0 );