def test___new___iterator(self): a = Vector(list(range(10))) b = Vector(range(10)) c = Vector(x for x in range(10)) d = Vector(map(lambda x: x, range(10))) assert a.equal(b) assert a.equal(c) assert a.equal(d)
def test___new___na_integer(self): # Should be upcast to float. # Missing values should be NaN. a = Vector([1, 2, NaN, None]) b = Vector([1, 2, NaN, NaN]) assert a.is_float() assert a.equal(b)
def test___new___na_datetime(self): # Should be converted to np.datetime64. # Missing values should be NaT. a = Vector([DATETIME, NaN, NaT, None]) b = Vector([DATETIME, NaT, NaT, NaT]) assert a.is_datetime() assert a.equal(b)
def test___new___na_boolean(self): # Should be upcast to object. # Missing values should be None. a = Vector([True, False, NaN, None]) b = Vector([True, False, None, None]) assert a.is_object() assert a.equal(b)
def test___new___na_float(self): # Missing values should be NaN. a = Vector([1.1, 2.2, NaN, None]) b = Vector([1.1, 2.2, NaN, NaN]) assert a.is_float() assert a.equal(b)
def test_equal_string(self): a = Vector(["a", "b", ""]) b = Vector(["a", "b", ""]) assert a.equal(b) assert not a.equal(b[::-1])
def test_equal_integer(self): a = Vector([1, 2, 3]) b = Vector([1, 2, 3]) assert a.equal(b) assert not a.equal(b[::-1])
def test_equal_float(self): a = Vector([1.1, 2.2, NaN]) b = Vector([1.1, 2.2, NaN]) assert a.equal(b) assert not a.equal(b[::-1])
def test_equal_datetime(self): a = Vector([DATETIME, NaT]) b = Vector([DATETIME, NaT]) assert a.equal(b) assert not a.equal(b[::-1])
def test_equal_boolean(self): a = Vector([True, False]) b = Vector([True, False]) assert a.equal(b) assert not a.equal(b[::-1])
def test___new___na_string(self): # Missing values should be blank strings. a = Vector(["a", "b", "", NaN, None]) b = Vector(["a", "b", "", "", ""]) assert a.is_string() assert a.equal(b)