Skip to content
Snippets Groups Projects
Unverified Commit 13c04ecc authored by Kieron Taylor's avatar Kieron Taylor Committed by GitHub
Browse files

Merge pull request #353 from kiwiroy/csa-remove-seqlevel

Improve symmetry of store / remove in CoordSystemAdaptor
parents ed823e0e 4a938388
No related branches found
No related tags found
No related merge requests found
......@@ -1284,6 +1284,10 @@ sub remove {
delete $self->{'_dbID_cache'}->{$dbID};
delete $self->{'_rank_cache'}->{$rank};
delete $self->{'_is_sequence_level'}->{$dbID};
delete $self->{'_is_default_version'}->{$dbID};
$cs->dbID(undef);
$cs->adaptor(undef);
return $cs;
}
......
......@@ -225,6 +225,18 @@ is_deeply(
'Retrieval by name should return the same as version for NCBI33');
is_deeply($csa->fetch_all_by_version('thisdoesnotexist'), [], 'Bogus coordinate system results in no results');
#
# Test remove() and store() sequence level
#
$cs = $csa->fetch_sequence_level();
ok($cs, 'There is a sequence level coord system - fetched ok');
ok($cs->is_default, 'sequence level is the default coord system');
my $old_dbID = $cs->dbID;
is($csa->remove($cs), $cs, 'Adaptor remove() returns the same coordinate system object');
is_deeply($csa->{_is_sequence_level}, {}, 'Adaptor sequence_level cache updated to reflect the removal');
is($csa->{_is_default_version}{$old_dbID}, undef, 'Adaptor default_version cache updated to reflect removal');
lives_ok(sub { $csa->store($cs); }, 'Adaptor store() successful. Coordinate system did not have dbID() or adaptor()');
$multi->restore('core', 'coord_system');
$multi->restore('core', 'meta');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment