File: SeqVersion.t

package info (click to toggle)
bioperl 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 40,768 kB
  • ctags: 12,005
  • sloc: perl: 174,299; xml: 13,923; sh: 1,941; lisp: 1,803; asm: 109; makefile: 53
file content (40 lines) | stat: -rw-r--r-- 997 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*-Perl-*- Test Harness script for Bioperl
# $Id: SeqVersion.t 15112 2008-12-08 18:12:38Z sendu $

use strict;

BEGIN {
  use lib '.';
  use Bio::Root::Test;
  
  test_begin(-tests => 10,
			 -requires_module => 'LWP::UserAgent');
  
  use_ok('Bio::DB::SeqVersion');
}

ok my $query = Bio::DB::SeqVersion->new(-type => 'gi');

SKIP: {
	test_skip(-tests => 8, -requires_networking => 1);

	eval { $query->get_history('DODGY_ID_WHICH_SHOULD_FAIL') };
	like($@, qr/could not parse/i, 'throw on bad ID');

	my $latest_gi = $query->get_recent(2);
	is($latest_gi, 2, 'get_recent');

	my @all_gis = $query->get_all(2);
	is(scalar @all_gis, 8, 'get_all');

	$latest_gi = $query->get_recent('A00002');
	is($latest_gi, 2, 'get_recent, string');

	$latest_gi = $query->get_recent(27478738);
	is($latest_gi, 42659163, 'get_recent, integer');

	# check that default type is "gi"
	ok $query = Bio::DB::SeqVersion->new();
	ok my $ref = $query->get_history(3245);
	is($ref->[0]->[0], 578167, 'get_history');
}