Closed fabianegli closed 3 years ago
It's a good point and I seem to have utilized assert
quite a bit.
I'll make a PR to change them to explicit tests.
$ grep -R assert *
download_cache.py: assert path_or_url, "Expected non-empty string for path_or_url"
download_cache.py: assert path_or_url, "Expected non-empty string for path_or_url"
download_cache.py: assert path_or_url, "Expected non-empty string for path_or_url"
download_cache.py: assert n_missing > 0
genome.py: assert self.gtf_path is not None
genome.py: assert self.protein_fasta_paths is not None
genome.py: assert self.transcript_fasta_paths is not None
genome.py: assert len(result) >= 4 and len(result) <= 6, \
genome.py: assert len(results) == 1, \
genome.py: assert 5 <= len(result) <= 5 + len(optional_field_names), \
genome.py: assert len(transcript_names) == 1, \
genome.py: assert len(results) == 1, \
locus.py: assert start <= end, \
species.py: assert i not in self._release_to_genome, \
transcript.py: assert exon_number >= 1, "Invalid exon number: %s" % exon_number
transcript.py: assert exon_number <= len(exons), \
transcript.py: assert all(exon is not None for exon in exons), \
transcript.py: assert position not in results, \
transcript.py: # typechecks.require_integer to a simpler assertion
transcript.py: assert type(position) == int, \
transcript.py: assert offsets[i] + 1 == offsets[i + 1], \
assert
is used in thedownload_cache.py
outside the scope of testing. This will not be executed if the module is run with optimization. If this is intended to be a test, it should be implemented in another way.From https://stackoverflow.com/a/1838411/6018688
"assert" statements are removed when the compilation is optimized
and here's the official documentation statingassert
s relationship with debugging, i.e.__debug__
.There might be other places where assert is used and maybe should be replaced with tests that survive optimization.