예제 #1
0
def test_ensure_datetime64ns_bigendian():
    # GH#29684
    arr = np.array([np.datetime64(1, "ms")], dtype=">M8[ms]")
    result = conversion.ensure_datetime64ns(arr)

    expected = np.array([np.datetime64(1, "ms")], dtype="M8[ns]")
    tm.assert_numpy_array_equal(result, expected)
예제 #2
0
 def test_length_zero_copy(self, dtype, copy):
     arr = np.array([], dtype=dtype)
     result = conversion.ensure_datetime64ns(arr, copy=copy)
     if copy:
         assert result.base is None
     else:
         assert result.base is arr
예제 #3
0
 def test_length_zero_copy(self, dtype, copy):
     arr = np.array([], dtype=dtype)
     result = conversion.ensure_datetime64ns(arr, copy=copy)
     if copy:
         assert result.base is None
     else:
         assert result.base is arr
예제 #4
0
def test_length_zero_copy(dtype, copy):
    arr = np.array([], dtype=dtype)
    result = conversion.ensure_datetime64ns(arr, copy=copy)
    if copy:
        assert not np.shares_memory(result, arr)
    else:
        if arr.dtype == result.dtype:
            assert result is arr
        else:
            assert not np.shares_memory(result, arr)
예제 #5
0
def test_length_zero_copy(dtype, copy):
    arr = np.array([], dtype=dtype)
    result = conversion.ensure_datetime64ns(arr, copy=copy)
    assert result.base is (None if copy else arr)
예제 #6
0
    def test_index_cast_datetime64_other_units(self):
        arr = np.arange(0, 100, 10, dtype=np.int64).view("M8[D]")
        idx = Index(arr)

        assert (idx.values == conversion.ensure_datetime64ns(arr)).all()
예제 #7
0
    def test_index_cast_datetime64_other_units(self):
        arr = np.arange(0, 100, 10, dtype=np.int64).view('M8[D]')
        idx = Index(arr)

        assert (idx.values == conversion.ensure_datetime64ns(arr)).all()
예제 #8
0
def test_length_zero_copy(dtype, copy):
    arr = np.array([], dtype=dtype)
    result = conversion.ensure_datetime64ns(arr, copy=copy)
    assert result.base is (None if copy else arr)