[Bioperl-guts-l] bioperl-live/t Location.t, 1.29, 1.30 LocationFactory.t, 1.12, 1.13
Christopher John Fields
cjfields at dev.open-bio.org
Thu Sep 7 16:48:39 EDT 2006
Update of /home/repository/bioperl/bioperl-live/t
In directory dev.open-bio.org:/tmp/cvs-serv17677/t
Modified Files:
Location.t LocationFactory.t
Log Message:
Change to Test::More
Index: LocationFactory.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/LocationFactory.t,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** LocationFactory.t 28 Oct 2005 13:07:35 -0000 1.12
--- LocationFactory.t 7 Sep 2006 20:48:36 -0000 1.13
***************
*** 11,27 ****
# we include the t dir (where a copy of Test.pm is located)
# as a fallback
! eval { require Test; };
if ( $@ ) {
use lib 't';
}
! use Test;
! plan tests => 270;
}
! use Bio::Factory::FTLocationFactory;
! use Bio::Factory::LocationFactoryI;
! use Bio::Location::Simple;
! use Bio::Location::Split;
! use Bio::Location::Fuzzy;
my $simple_impl = "Bio::Location::Simple";
--- 11,27 ----
# we include the t dir (where a copy of Test.pm is located)
# as a fallback
! eval { require Test::More; };
if ( $@ ) {
use lib 't';
}
! use Test::More;
! plan tests => 275;
}
! use_ok('Bio::Factory::FTLocationFactory');
! use_ok('Bio::Factory::LocationFactoryI');
! use_ok('Bio::Location::Simple');
! use_ok('Bio::Location::Split');
! use_ok('Bio::Location::Fuzzy');
my $simple_impl = "Bio::Location::Simple";
***************
*** 94,98 ****
my $locfac = Bio::Factory::FTLocationFactory->new();
! ok($locfac->isa("Bio::Factory::LocationFactoryI"));
# sorting is to keep the order constant from one run to the next
--- 94,98 ----
my $locfac = Bio::Factory::FTLocationFactory->new();
! isa_ok($locfac,'Bio::Factory::LocationFactoryI');
# sorting is to keep the order constant from one run to the next
***************
*** 103,124 ****
}
my @res = @{$testcases{$locstr}};
! ok(ref($loc), $res[0]);
! ok($loc->min_start(), $res[1]);
! ok($loc->max_start(), $res[2]);
! ok($loc->start_pos_type(), $res[3]);
! ok($loc->min_end(), $res[4]);
! ok($loc->max_end(), $res[5]);
! ok($loc->end_pos_type(), $res[6]);
! ok($loc->location_type(), $res[7]);
my @locs = $loc->each_Location();
! ok(@locs, $res[8]);
my $ftstr = $loc->to_FTstring();
# this is a somewhat ugly hack, but we want clean output from to_FTstring()
$locstr = "J00194:100..202" if $locstr eq "J00194:(100..202)";
$locstr = "(122.133)..(204.221)" if $locstr eq "((122.133)..(204.221))";
# now test
! ok($ftstr, $locstr);
# test strand production
! ok($loc->strand(), $res[9]);
}
--- 103,126 ----
}
my @res = @{$testcases{$locstr}};
! is(ref($loc), $res[0], $res[0]);
! is($loc->min_start(), $res[1]);
! is($loc->max_start(), $res[2]);
! is($loc->start_pos_type(), $res[3]);
! is($loc->min_end(), $res[4]);
! is($loc->max_end(), $res[5]);
! is($loc->end_pos_type(), $res[6]);
! is($loc->location_type(), $res[7]);
my @locs = $loc->each_Location();
! is(@locs, $res[8]);
my $ftstr = $loc->to_FTstring();
# this is a somewhat ugly hack, but we want clean output from to_FTstring()
+ # Umm, then these should really fail, correct?
+ # Should we be engineering workarounds for tests?
$locstr = "J00194:100..202" if $locstr eq "J00194:(100..202)";
$locstr = "(122.133)..(204.221)" if $locstr eq "((122.133)..(204.221))";
# now test
! is($ftstr, $locstr, "Location String: $locstr");
# test strand production
! is($loc->strand(), $res[9]);
}
***************
*** 148,152 ****
my $loc = $locfac->from_string($locstr);
my $ftstr = $loc->to_FTstring();
! ok($ftstr, shift @expected);
}
} else {
--- 150,154 ----
my $loc = $locfac->from_string($locstr);
my $ftstr = $loc->to_FTstring();
! is($ftstr, shift @expected);
}
} else {
Index: Location.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/Location.t,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** Location.t 16 Jan 2006 15:04:50 -0000 1.29
--- Location.t 7 Sep 2006 20:48:36 -0000 1.30
***************
*** 11,29 ****
# we include the t dir (where a copy of Test.pm is located)
# as a fallback
! eval { require Test; };
if( $@ ) {
use lib 't';
}
! use Test;
! plan tests => 85;
}
! use Bio::Location::Simple;
! use Bio::Location::Split;
! use Bio::Location::Fuzzy;
! use Bio::SeqFeature::Generic;
! use Bio::SeqFeature::SimilarityPair;
! use Bio::SeqFeature::FeaturePair;
ok(1);
--- 11,29 ----
# we include the t dir (where a copy of Test.pm is located)
# as a fallback
! eval { require Test::More; };
if( $@ ) {
use lib 't';
}
! use Test::More;
! plan tests => 101;
}
! use_ok('Bio::Location::Simple');
! use_ok('Bio::Location::Split');
! use_ok('Bio::Location::Fuzzy');
! use_ok('Bio::SeqFeature::Generic');
! use_ok('Bio::SeqFeature::SimilarityPair');
! use_ok('Bio::SeqFeature::FeaturePair');
ok(1);
***************
*** 31,50 ****
my $simple = new Bio::Location::Simple('-start' => 10, '-end' => 20,
'-strand' => 1, -seq_id => 'my1');
! ok $simple->isa('Bio::LocationI') && $simple->isa('Bio::RangeI');
! ok $simple->start, 10;
! ok $simple->end, 20;
! ok $simple->seq_id, 'my1';
my ($loc) = $simple->each_Location();
! ok $loc;
! ok ("$loc", "$simple");
my $generic = new Bio::SeqFeature::Generic('-start' => 5, '-end' => 30,
'-strand' => 1);
! ok $generic->isa('Bio::SeqFeatureI') && $generic->isa('Bio::RangeI');
! ok $generic->start, 5;
! ok $generic->end, 30;
my $similarity = new Bio::SeqFeature::SimilarityPair();
--- 31,52 ----
my $simple = new Bio::Location::Simple('-start' => 10, '-end' => 20,
'-strand' => 1, -seq_id => 'my1');
! isa_ok($simple, 'Bio::LocationI');
! isa_ok($simple, 'Bio::RangeI');
! is($simple->start, 10, 'Bio::Location::Simple tests');
! is($simple->end, 20);
! is($simple->seq_id, 'my1');
my ($loc) = $simple->each_Location();
! ok($loc);
! is("$loc", "$simple");
my $generic = new Bio::SeqFeature::Generic('-start' => 5, '-end' => 30,
'-strand' => 1);
! isa_ok($generic,'Bio::SeqFeatureI', 'Bio::SeqFeature::Generic' );
! isa_ok($generic,'Bio::RangeI');
! is($generic->start, 5);
! is($generic->end, 30);
my $similarity = new Bio::SeqFeature::SimilarityPair();
***************
*** 61,71 ****
'-strand' => -1);
! ok($featpair->start, 30);
! ok($featpair->end, 43);
! ok($featpair->length, 14);
ok($featpair->overlaps($feat3));
! ok($generic->overlaps($simple));
ok($generic->contains($simple));
--- 63,73 ----
'-strand' => -1);
! is($featpair->start, 30,'Bio::SeqFeature::FeaturePair tests');
! is($featpair->end, 43);
! is($featpair->length, 14);
ok($featpair->overlaps($feat3));
! ok($generic->overlaps($simple), 'Bio::SeqFeature::Generic tests');
ok($generic->contains($simple));
***************
*** 76,95 ****
-seq_id =>'my2');
! ok($fuzzy->strand, 1);
! ok($fuzzy->start, 10);
! ok($fuzzy->end,20);
! ok(! defined $fuzzy->min_start);
! ok($fuzzy->max_start, 10);
! ok($fuzzy->min_end, 20);
! ok($fuzzy->max_end, 20);
! ok($fuzzy->location_type, 'EXACT');
! ok($fuzzy->start_pos_type, 'BEFORE');
! ok($fuzzy->end_pos_type, 'EXACT');
! ok $fuzzy->seq_id, 'my2';
! ok $fuzzy->seq_id('my3'), 'my3';
($loc) = $fuzzy->each_Location();
! ok $loc;
! ok ("$loc", "$fuzzy");
# split location tests
--- 78,97 ----
-seq_id =>'my2');
! is($fuzzy->strand, 1, 'Bio::Location::Fuzzy tests');
! is($fuzzy->start, 10);
! is($fuzzy->end,20);
! ok(!defined $fuzzy->min_start);
! is($fuzzy->max_start, 10);
! is($fuzzy->min_end, 20);
! is($fuzzy->max_end, 20);
! is($fuzzy->location_type, 'EXACT');
! is($fuzzy->start_pos_type, 'BEFORE');
! is($fuzzy->end_pos_type, 'EXACT');
! is($fuzzy->seq_id, 'my2');
! is($fuzzy->seq_id('my3'), 'my3');
($loc) = $fuzzy->each_Location();
! ok($loc);
! is("$loc", "$fuzzy");
# split location tests
***************
*** 99,105 ****
-strand => 1);
$splitlocation->add_sub_Location($f);
! ok($f->start, 13);
! ok($f->min_start, 13);
! ok($f->max_start,13);
--- 101,107 ----
-strand => 1);
$splitlocation->add_sub_Location($f);
! is($f->start, 13, 'Bio::Location::Split tests');
! is($f->min_start, 13);
! is($f->max_start,13);
***************
*** 123,149 ****
-end =>61,
-strand =>1);
! ok($f->start, 50);
ok(! defined $f->min_start);
! ok($f->max_start, 50);
! ok (scalar($splitlocation->each_Location()), 4);
$splitlocation->add_sub_Location($f);
! ok($splitlocation->max_end, 90);
! ok($splitlocation->min_start, 13);
! ok($splitlocation->end, 90);
! ok($splitlocation->start, 13);
! ok($splitlocation->sub_Location(),5);
! ok($fuzzy->to_FTstring(), '<10..20');
$fuzzy->strand(-1);
! ok($fuzzy->to_FTstring(), 'complement(<10..20)');
! ok($simple->to_FTstring(), '10..20');
$simple->strand(-1);
! ok($simple->to_FTstring(), 'complement(10..20)');
! ok( $splitlocation->to_FTstring(),
'join(13..30,30..90,18..22,19..20,<50..61)');
# test for bug #1074
$f = new Bio::Location::Simple(-start => 5,
--- 125,152 ----
-end =>61,
-strand =>1);
! is($f->start, 50);
ok(! defined $f->min_start);
! is($f->max_start, 50);
! is(scalar($splitlocation->each_Location()), 4);
$splitlocation->add_sub_Location($f);
! is($splitlocation->max_end, 90);
! is($splitlocation->min_start, 13);
! is($splitlocation->end, 90);
! is($splitlocation->start, 13);
! is($splitlocation->sub_Location(),5);
! is($fuzzy->to_FTstring(), '<10..20');
$fuzzy->strand(-1);
! is($fuzzy->to_FTstring(), 'complement(<10..20)');
! is($simple->to_FTstring(), '10..20');
$simple->strand(-1);
! is($simple->to_FTstring(), 'complement(10..20)');
! is( $splitlocation->to_FTstring(),
'join(13..30,30..90,18..22,19..20,<50..61)');
+
# test for bug #1074
$f = new Bio::Location::Simple(-start => 5,
***************
*** 151,158 ****
-strand => -1);
$splitlocation->add_sub_Location($f);
! ok( $splitlocation->to_FTstring(),
! 'join(13..30,30..90,18..22,19..20,<50..61,complement(5..12))');
$splitlocation->strand(-1);
! ok( $splitlocation->to_FTstring(),
'complement(join(13..30,30..90,18..22,19..20,<50..61,5..12))');
--- 154,162 ----
-strand => -1);
$splitlocation->add_sub_Location($f);
! is( $splitlocation->to_FTstring(),
! 'join(13..30,30..90,18..22,19..20,<50..61,complement(5..12))',
! 'Bugfix 1074');
$splitlocation->strand(-1);
! is( $splitlocation->to_FTstring(),
'complement(join(13..30,30..90,18..22,19..20,<50..61,5..12))');
***************
*** 160,166 ****
-end => '75^80');
! ok($f->to_FTstring(), '(45.60)..(75^80)');
$f->start('20>');
! ok($f->to_FTstring(), '>20..(75^80)');
# test that even when end < start that length is always positive
--- 164,170 ----
-end => '75^80');
! is($f->to_FTstring(), '(45.60)..(75^80)');
$f->start('20>');
! is($f->to_FTstring(), '>20..(75^80)');
# test that even when end < start that length is always positive
***************
*** 171,208 ****
-strand => 1);
! ok($f->length, 81);
! ok($f->strand,-1);
# test that can call seq_id() on a split location;
$splitlocation = new Bio::Location::Split(-seq_id => 'mysplit1');
! ok $splitlocation->seq_id,'mysplit1';
! ok $splitlocation->seq_id('mysplit2'),'mysplit2';
# Test Bio::Location::Exact
! ok my $exact = new Bio::Location::Simple(-start => 10,
-end => 20,
-strand => 1,
! -seq_id => 'my1');
! ok $exact->isa('Bio::LocationI') && $exact->isa('Bio::RangeI');
! ok $exact->start, 10;
! ok $exact->end, 20;
! ok $exact->seq_id, 'my1';
! ok $exact->length, 11;
! ok $exact->location_type, 'EXACT';
! ok $exact = new Bio::Location::Simple(-start => 10,
-end => 11,
-location_type => 'IN-BETWEEN',
-strand => 1,
! -seq_id => 'my2');
! ok $exact->start, 10;
! ok $exact->end, 11;
! ok $exact->seq_id, 'my2';
! ok $exact->length, 0;
! ok $exact->location_type, 'IN-BETWEEN';
eval {
--- 175,213 ----
-strand => 1);
! is($f->length, 81, 'Positive length');
! is($f->strand,-1);
# test that can call seq_id() on a split location;
$splitlocation = new Bio::Location::Split(-seq_id => 'mysplit1');
! is($splitlocation->seq_id,'mysplit1', 'seq_id() on Bio::Location::Split');
! is($splitlocation->seq_id('mysplit2'),'mysplit2');
# Test Bio::Location::Exact
! ok(my $exact = new Bio::Location::Simple(-start => 10,
-end => 20,
-strand => 1,
! -seq_id => 'my1'));
! isa_ok($exact, 'Bio::LocationI');
! isa_ok($exact, 'Bio::RangeI');
! is( $exact->start, 10, 'Bio::Location::Simple EXACT');
! is( $exact->end, 20);
! is( $exact->seq_id, 'my1');
! is( $exact->length, 11);
! is( $exact->location_type, 'EXACT');
! ok ($exact = new Bio::Location::Simple(-start => 10,
-end => 11,
-location_type => 'IN-BETWEEN',
-strand => 1,
! -seq_id => 'my2'));
! is($exact->start, 10, 'Bio::Location::Simple IN-BETWEEN');
! is($exact->end, 11);
! is($exact->seq_id, 'my2');
! is($exact->length, 0);
! is($exact->location_type, 'IN-BETWEEN');
eval {
***************
*** 211,215 ****
-location_type => 'IN-BETWEEN');
};
! ok( $@ );
# testing error when assigning 10^11 simple location into fuzzy
--- 216,220 ----
-location_type => 'IN-BETWEEN');
};
! ok( $@, 'Testing error handling' );
# testing error when assigning 10^11 simple location into fuzzy
***************
*** 241,274 ****
ok($@);
-
-
# testing coodinate policy modules
! use Bio::Location::WidestCoordPolicy;
! use Bio::Location::NarrowestCoordPolicy;
! use Bio::Location::AvWithinCoordPolicy;
$f = new Bio::Location::Fuzzy(-start => '40.60',
-end => '80.100');
! ok $f->start, 40;
! ok $f->end, 100;
! ok $f->length, 61;
! ok ref $f->coordinate_policy, 'Bio::Location::WidestCoordPolicy';
$f->coordinate_policy(new Bio::Location::NarrowestCoordPolicy);
! ok $f->start, 60;
! ok $f->end, 80;
! ok $f->length, 21;
$f->coordinate_policy(new Bio::Location::AvWithinCoordPolicy);
! ok $f->start, 50;
! ok $f->end, 90;
! ok $f->length, 41;
# to complete the circle
$f->coordinate_policy(new Bio::Location::WidestCoordPolicy);
! ok $f->start, 40;
! ok $f->end, 100;
! ok $f->length, 61;
--- 246,283 ----
ok($@);
# testing coodinate policy modules
! use_ok('Bio::Location::WidestCoordPolicy');
! use_ok('Bio::Location::NarrowestCoordPolicy');
! use_ok('Bio::Location::AvWithinCoordPolicy');
$f = new Bio::Location::Fuzzy(-start => '40.60',
-end => '80.100');
! is $f->start, 40, 'Default coodinate policy';
! is $f->end, 100;
! is $f->length, 61;
! is $f->to_FTstring, '(40.60)..(80.100)';
! is ref $f->coordinate_policy, 'Bio::Location::WidestCoordPolicy';
+ # this gives an odd location string; is it legal?
$f->coordinate_policy(new Bio::Location::NarrowestCoordPolicy);
! is $f->start, 60, 'Narrowest coodinate policy';
! is $f->end, 80;
! is $f->length, 21;
! is $f->to_FTstring, '(60.60)..(80.80)';
+ # this gives an odd location string
$f->coordinate_policy(new Bio::Location::AvWithinCoordPolicy);
! is $f->start, 50, 'Average coodinate policy';
! is $f->end, 90;
! is $f->length, 41;
! is $f->to_FTstring, '(50.60)..(80.90)';
# to complete the circle
$f->coordinate_policy(new Bio::Location::WidestCoordPolicy);
! is $f->start, 40, 'Widest coodinate policy';
! is $f->end, 100;
! is $f->length, 61;
! is $f->to_FTstring, '(40.60)..(80.100)';
More information about the Bioperl-guts-l
mailing list