Skip to content

Cannot add frozen boxes #291

@m-janicki

Description

@m-janicki

What happens

when I add two frozen boxes

c = a + b

exception is being thrown

  File "box/box.py", line 311, in box.box.Box.__add__
  File "box/box.py", line 862, in box.box.Box.merge_update
  File "box/box.py", line 842, in box.box.Box.merge_update.convert_and_set
  File "box/box.py", line 862, in box.box.Box.merge_update
  File "box/box.py", line 854, in box.box.Box.merge_update.convert_and_set
  File "box/box.py", line 654, in box.box.Box.__setitem__
box.exceptions.BoxError: Box is frozen

What should happen

New frozen box should be created by deeply merging (merge_update) a and b

How to reproduce

from box import Box

a = Box(foo={'bar': 1}, frozen_box=True)
b = Box(foo={'baz': 2}, frozen_box=True)

print(a + b)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions