-
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: explicit 'import awkward' needed to write NumPy strings (#1266)
- Loading branch information
Showing
2 changed files
with
32 additions
and
5 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,18 @@ | ||
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE | ||
|
||
import pytest | ||
import uproot | ||
import os | ||
import numpy as np | ||
|
||
|
||
def test(tmp_path): | ||
newfile = os.path.join(tmp_path, "example.root") | ||
|
||
with uproot.recreate(newfile) as f: | ||
f["t"] = {"x": np.array(["A", "B"]), "y": np.array([1, 2])} | ||
f["t"].extend({"x": np.array(["A", "B"]), "y": np.array([1, 2])}) | ||
|
||
with uproot.open(newfile) as f: | ||
assert f["t"]["x"].array().tolist() == ["A", "B", "A", "B"] | ||
assert f["t"]["y"].array().tolist() == [1, 2, 1, 2] |