Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def dec(self):
"""
Declination.
"""
if isinstance(self, FixedTarget):
return self.coord.dec
raise NotImplementedError()
and the `--remote-data` option isn't used.
The way this setup works is that for functionality that usually requires
internet access, but has mocks in place, it is possible to write the test
without adding a `@remote_data` decorator, and `py.test` will do the right
thing when running the tests:
1. Access the internet and use the normal code if `--remote-data` is used
2. Not access the internet and use the mock code if `--remote-data` is not used
Both of these cases are tested on travis-ci.
"""
from .target import FixedTarget
from astropy.coordinates import EarthLocation
if not hasattr(FixedTarget, '_real_from_name'):
FixedTarget._real_from_name = FixedTarget.from_name
FixedTarget.from_name = FixedTarget._from_name_mock
if not hasattr(EarthLocation, '_real_of_site'):
EarthLocation._real_of_site = EarthLocation.of_site
EarthLocation.of_site = EarthLocation_mock.of_site_mock