Skip to content

Commit 98fd7c5

Browse files
committed
small fix to type hints
1 parent a26888b commit 98fd7c5

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

docs/change_log.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,12 @@ an installation requirement.
184184
- Remove travis-CI configs as it is no longer used
185185
- Merge coveragerc file into pyproject.toml
186186

187-
3.2.0 (04/14/25)
187+
3.2.0 (04/15/25)
188188
~~~~~~~~~~~~~~~~
189189
- Add type hints
190190
- Add as_namedtuple option to DataFrame get_columns() and get_location()
191191
- minimum python version now 3.11
192+
193+
3.2.1 (04/15/25)
194+
~~~~~~~~~~~~~~~~
195+
- Fix to type hints

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "raccoon"
3-
version = "3.2.0"
3+
version = "3.2.1"
44
authors = [
55
{ name = "Ryan Sheftel", email = "rsheftel@alumni.upenn.edu" },
66
]

raccoon/dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DataFrame(object):
2929

3030
def __init__(
3131
self,
32-
data: dict[Any, list] | None = None,
32+
data: dict[Any, list | Any] | None = None,
3333
columns: list | None = None,
3434
index: list | None = None,
3535
index_name: str | tuple | None = "index",

tests/test_dataframe/test_dataframe.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ def check_list():
4343
check_list()
4444

4545

46+
def test_construction():
47+
actual = rc.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, index=["a", "b", "c"], columns=["b", "a"])
48+
assert actual.data == [[4, 5, 6], [1, 2, 3]]
49+
actual = rc.DataFrame({"a": 9, "b": 10})
50+
assert actual.data == [[9], [10]]
51+
actual = rc.DataFrame({"a": 9, "b": {"another": 90}}, index=["odd"])
52+
assert actual.data == [[9], [{"another": 90}]]
53+
54+
# data length is mismatch with index length
55+
with pytest.raises(ValueError):
56+
rc.DataFrame({"a": 9, "b": {"another": 90}}, index=["a", "b", "c"])
57+
58+
4659
def test_to_dict():
4760
df = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, index=['a', 'b', 'c'], columns=['b', 'a'])
4861

0 commit comments

Comments
 (0)