From b51546435eeee26a59025cffdfbe204c0dd19215 Mon Sep 17 00:00:00 2001 From: Andrew Yates <ayates@ebi.ac.uk> Date: Wed, 19 Oct 2011 11:34:36 +0000 Subject: [PATCH] Test case added for unversioned CS and subsequent bugfix --- modules/Bio/EnsEMBL/DataFile.pm | 2 +- modules/t/dataFile.t | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/modules/Bio/EnsEMBL/DataFile.pm b/modules/Bio/EnsEMBL/DataFile.pm index de1ef20b58..48820b7b8d 100644 --- a/modules/Bio/EnsEMBL/DataFile.pm +++ b/modules/Bio/EnsEMBL/DataFile.pm @@ -107,7 +107,7 @@ sub path { my @portions; push(@portions, $production_name); - push(@portions, $self->coord_system()->version()); + push(@portions, $cs_version); push(@portions, software_version()) if $self->version_lock(); push(@portions, $self->adaptor()->db()->group()); diff --git a/modules/t/dataFile.t b/modules/t/dataFile.t index eb15fe5b37..4bdc5d85b8 100644 --- a/modules/t/dataFile.t +++ b/modules/t/dataFile.t @@ -36,7 +36,7 @@ my %base_args = ( my $df = new_ok('Bio::EnsEMBL::DataFile' => [ %base_args ], 'data file'); - is($df->path($base), $expected_base.'/core/wibble.bam', 'Checking path non-absolute path'); + is($df->path($base), $expected_base.'/core/wibble.bam', 'Checking non-absolute path'); } { @@ -45,16 +45,27 @@ my %base_args = ( -VERSION_LOCK => 1, ], 'data file'); - is($df->path($base), $expected_base.'/'.software_version().'/core/wibble.bam', 'Checking path non-absolute path'); + is($df->path($base), $expected_base.'/'.software_version().'/core/wibble.bam', 'Checking non-absolute version locked path'); } { + my $url = 'http://www.google.co.uk/wibble.bam'; my $df = new_ok('Bio::EnsEMBL::DataFile' => [ %base_args, - -VERSION_LOCK => 1, + -ABSOLUTE => 1, + -URL => $url ], 'data file'); - is($df->path($base), $expected_base.'/'.software_version().'/core/wibble.bam', 'Checking path non-absolute path'); + is($df->path(), $url, 'Checking absolute path'); +} + +{ + my $supercontig_cs = $csa->fetch_by_dbID(2); + my $df = new_ok('Bio::EnsEMBL::DataFile' => [ + %base_args, + -COORD_SYSTEM => $supercontig_cs + ], 'data file'); + is($df->path($base), $expected_base.'/core/wibble.bam', 'Checking non-absolute unversioned cs path'); } { @@ -80,7 +91,7 @@ my %base_args = ( is_deeply($dfa->fetch_all_by_Analysis($a), [$df], 'Checking retrieved data is the same as what we currently hold'); is_deeply($dfa->fetch_all_by_CoordSystem($cs), [$df], 'Checking retrieved data is the same as what we currently hold'); is_deeply($dfa->fetch_by_name_and_type('wibble', 'BAM'), $df, 'Checking retrieved data is the same as what we currently hold'); - + $multi->restore(qw/core data_file/); } -- GitLab