# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import copy import functools import datetime from copy import deepcopy from decimal import Decimal, localcontext import numpy as np import pytest from numpy.testing import assert_allclose import erfa from erfa import ErfaWarning from astropy.utils.exceptions import AstropyDeprecationWarning from astropy.utils import isiterable, iers from astropy.time import (Time, TimeDelta, ScaleValueError, STANDARD_TIME_SCALES, TimeString, TimezoneInfo, TIME_FORMATS) from astropy.coordinates import EarthLocation from astropy import units as u from astropy.table import Column, Table from astropy.utils.compat.optional_deps import HAS_PYTZ # noqa allclose_jd = functools.partial(np.allclose, rtol=np.finfo(float).eps, atol=0) allclose_jd2 = functools.partial(np.allclose, rtol=np.finfo(float).eps, atol=np.finfo(float).eps) # 20 ps atol allclose_sec = functools.partial(np.allclose, rtol=np.finfo(float).eps, atol=np.finfo(float).eps * 24 * 3600) allclose_year = functools.partial(np.allclose, rtol=np.finfo(float).eps, atol=0.) # 14 microsec at current epoch def setup_function(func): func.FORMATS_ORIG = deepcopy(Time.FORMATS) def teardown_function(func): Time.FORMATS.clear() Time.FORMATS.update(func.FORMATS_ORIG) class TestBasic: """Basic tests stemming from initial example and API reference""" def test_simple(self): times = ['1999-01-01 00:00:00.123456789', '2010-01-01 00:00:00'] t = Time(times, format='iso', scale='utc') assert (repr(t) == "