File: test_1505.py

package info (click to toggle)
python-asdf 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 7,032 kB
  • sloc: python: 24,068; makefile: 123
file content (23 lines) | stat: -rw-r--r-- 469 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import numpy as np

import asdf


def test_update_fails_after_write_to(tmp_path):
    """
    Calling update after write_to fails

    https://github.com/asdf-format/asdf/issues/1505
    """
    fn1 = tmp_path / "test1.asdf"
    fn2 = tmp_path / "test2.asdf"

    tree = {"a": np.zeros(3), "b": np.ones(3)}
    af = asdf.AsdfFile(tree)

    af.write_to(fn1)

    with asdf.open(fn1, mode="rw") as af:
        af["a"] = None
        af.write_to(fn2)
        af.update()