File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -127,8 +127,6 @@ def __init__(
127
127
"""
128
128
self ._hist : Any = None
129
129
self .axes : NamedAxesTuple
130
- self .name = name
131
- self .label = label
132
130
133
131
args : tuple [AxisTypes , ...]
134
132
@@ -179,6 +177,9 @@ def __init__(
179
177
if data is not None :
180
178
self [...] = data
181
179
180
+ self .name = name
181
+ self .label = label
182
+
182
183
# Backport of storage_type from boost-histogram 1.3.2:
183
184
if not hasattr (bh .Histogram , "storage_type" ):
184
185
Original file line number Diff line number Diff line change @@ -20,3 +20,12 @@ def test_bh_conversion():
20
20
assert not isinstance (h3 .axes [0 ], hist .axis .Regular )
21
21
assert h2 .axes [0 ].name == "y"
22
22
assert h3 .axes [0 ].metadata == {"name" : "x" }
23
+
24
+
25
+ def test_bh_conversion_add_metadata ():
26
+ h = bh .Histogram (bh .axis .Regular (3 , 2 , 1 ))
27
+
28
+ h2 = hist .Hist (h , label = "abc" , name = "def" )
29
+
30
+ assert h2 .label == "abc"
31
+ assert h2 .name == "def"
You can’t perform that action at this time.
0 commit comments