Inzynierka/Lib/site-packages/pandas/tests/series/methods/test_set_name.py

22 lines
595 B
Python
Raw Permalink Normal View History

2023-06-02 12:51:02 +02:00
from datetime import datetime
from pandas import Series
class TestSetName:
def test_set_name(self):
ser = Series([1, 2, 3])
ser2 = ser._set_name("foo")
assert ser2.name == "foo"
assert ser.name is None
assert ser is not ser2
def test_set_name_attribute(self):
ser = Series([1, 2, 3])
ser2 = Series([1, 2, 3], name="bar")
for name in [7, 7.0, "name", datetime(2001, 1, 1), (1,), "\u05D0"]:
ser.name = name
assert ser.name == name
ser2.name = name
assert ser2.name == name