1 # -*-Perl-*- Test Harness script for Bioperl
9 test_begin( #-tests => 10,
10 -requires_modules => [qw(LWP::UserAgent HTML::TableExtract)]
13 use_ok('Bio::DB::SeqVersion');
16 my $DEBUG = $ENV{BIOPERLDEBUG} || 0;
18 ok my $query = Bio::DB::SeqVersion->new( -type => 'gi' );
21 test_skip( -tests => 8, -requires_networking => 1 );
23 throws_ok { $query->get_history('DODGY_ID_WHICH_SHOULD_FAIL') }
24 qr/ID likely does not exist|No table found/i, 'throw on bad ID';
26 my $latest_gi = $query->get_recent(2);
27 is($latest_gi, 2, 'get_recent');
28 is($query->get_status(2), 'live');
30 my @all_gis = $query->get_all(2);
31 cmp_ok(@all_gis, '>=', 8, 'get_all');
32 is($query->get_status(2), 'live');
34 $latest_gi = $query->get_recent('A00002');
35 is($latest_gi, 2, 'get_recent, string');
36 is($query->get_status('A00002'), 'live');
38 $latest_gi = $query->get_recent(27478738);
39 is($latest_gi, 42659163, 'get_recent, integer');
40 is($query->get_status(27478738), 'suppressed');
42 # check that default type is "gi"
43 ok $query = Bio::DB::SeqVersion->new();
44 ok my $ref = $query->get_history(3245);
45 is($ref->[0]->[0], 578167, 'get_history');
46 is($query->get_status('3245'), 'suppressed');