Exemplo n.º 1
0
def test_calc_freq():
    """Test index frequency calculation"""

    tind = pytime.create_datetime_index(year=np.ones(shape=(4, )) * 2001,
                                        month=np.ones(shape=(4, )),
                                        uts=np.arange(0.0, 4.0, 1.0))
    freq = pytime.calc_freq(tind)

    assert freq.find("1S") == 0
Exemplo n.º 2
0
def test_calc_freq_ns():
    """Test index frequency calculation with nanosecond output"""

    tind = pytime.create_datetime_index(year=np.ones(shape=(4, )) * 2001,
                                        month=np.ones(shape=(4, )),
                                        uts=np.arange(0.0, 0.04, .01))
    freq = pytime.calc_freq(tind)

    assert freq.find("10000000N") == 0
Exemplo n.º 3
0
    def test_calc_freq_ns(self):
        """Test index frequency calculation with nanosecond output"""

        tind = pytime.create_datetime_index(year=self.year,
                                            month=self.month,
                                            uts=np.arange(0.0, 0.04, .01))
        freq = pytime.calc_freq(tind)

        assert freq.find("10000000N") == 0
Exemplo n.º 4
0
    def test_calc_freq(self):
        """Test index frequency calculation"""

        tind = pytime.create_datetime_index(year=self.year,
                                            month=self.month,
                                            uts=np.arange(0.0, 4.0, 1.0))
        freq = pytime.calc_freq(tind)

        assert freq.find("1S") == 0
Exemplo n.º 5
0
def test_calc_freq_len_fail():
    """Test index frequency calculation with empty list"""

    pytime.calc_freq(list())
Exemplo n.º 6
0
def test_calc_freq_type_fail():
    """Test index frequency calculation with non-datetime list"""

    pytime.calc_freq([1, 2, 3, 4])
Exemplo n.º 7
0
    def test_calc_freq_type_fail(self):
        """Test index frequency calculation with non-datetime list"""

        with pytest.raises(AttributeError):
            pytime.calc_freq([1, 2, 3, 4])
Exemplo n.º 8
0
    def test_calc_freq_len_fail(self):
        """Test index frequency calculation with empty list"""

        with pytest.raises(ValueError):
            pytime.calc_freq(list())