-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow colon in key names (#1127)
* fix: allow column in key names * style: pre-commit fixes * Rename test file to match PR number. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
71cca34
commit 8a42e7d
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE | ||
|
||
import awkward as ak | ||
import uproot | ||
import skhep_testdata | ||
import numpy | ||
import os | ||
|
||
|
||
def test_colon_in_path_and_name(tmp_path): | ||
newfile = os.path.join(tmp_path, "test_colon_in_name.root") | ||
with uproot.recreate(newfile) as f: | ||
f["one:two"] = "together" | ||
array = ak.Array(["one", "two", "three"]) | ||
f["one"] = {"two": array} | ||
|
||
with uproot.open(newfile) as f: | ||
f["one:two"] == "together" | ||
f["one"]["two"].array() == ["one", "two", "three"] | ||
|
||
|
||
def test_colon_reading_in_path(): | ||
with uproot.open( | ||
skhep_testdata.data_path("uproot-small-evnt-tree-fullsplit.root") | ||
) as f: | ||
f["tree:evt/P3/P3.Py"].array() == numpy.arange(100) |