Skip to content

Commit b431936

Browse files
committed
add missing test files and license
1 parent f26190a commit b431936

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

license.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
License Terms for
2+
Proactive Data Containers (PDC) Software Library and Utilities
3+
-----------------------------------------------------------------------------
4+
5+
*** License Agreement ***
6+
7+
Proactive Data Containers (PDC) Copyright (c) 2017, The Regents of the
8+
University of California, through Lawrence Berkeley National Laboratory,
9+
UChicago Argonne, LLC, operator of Argonne National Laboratory, and The HDF
10+
Group (subject to receipt of any required approvals from the U.S. Dept. of
11+
Energy). All rights reserved.
12+
13+
Redistribution and use in source and binary forms, with or without modification,
14+
are permitted provided that the following conditions are met:
15+
16+
(1) Redistributions of source code must retain the above copyright notice, this
17+
list of conditions and the following disclaimer.
18+
19+
(2) Redistributions in binary form must reproduce the above copyright notice,
20+
this list of conditions and the following disclaimer in the documentation and/or
21+
other materials provided with the distribution.
22+
23+
(3) Neither the name of the University of California, Lawrence Berkeley National
24+
Laboratory, UChicago Argonne, LLC, Argonne National Laboratory, The HDF Group,
25+
U.S. Dept. of Energy nor the names of its contributors may be used to endorse or
26+
promote products derived from this software without specific prior written
27+
permission.
28+
29+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
33+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
36+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39+
40+
You are under no obligation whatsoever to provide any bug fixes, patches, or
41+
upgrades to the features, functionality or performance of the source code
42+
("Enhancements") to anyone; however, if you choose to make your Enhancements
43+
available either publicly, or directly to Lawrence Berkeley National Laboratory,
44+
without imposing a separate written license agreement for such Enhancements,
45+
then you hereby grant the following license: a non-exclusive, royalty-free
46+
perpetual license to install, use, modify, prepare derivative works, incorporate
47+
into other computer software, distribute, and sublicense such enhancements or
48+
derivative works thereof, in binary and source code form.

tests/examples/test_make_container.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import pdc
2+
3+
def test_make_container():
4+
#make a container. The container is persistent by default.
5+
cont = pdc.Container('persistent_cont')
6+
7+
#make a transient container, it will be deleted when the pdc server is closed
8+
cont2 = pdc.Container('transient_cont', lifetime=pdc.Container.Lifetime.TRANSIENT)
9+
10+
assert cont.lifetime == pdc.Container.Lifetime.PERSISTENT
11+
assert cont2.lifetime == pdc.Container.Lifetime.TRANSIENT

tests/examples/test_region_example.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import pdc
2+
import pdc.main
3+
import numpy as np
4+
import pytest
5+
6+
def test_region_example():
7+
cont = pdc.Container('region_example_cont', lifetime=pdc.Container.Lifetime.TRANSIENT)
8+
9+
data = [
10+
[2, 7, 6],
11+
[9, 5, 1],
12+
[4, 3, 8]
13+
]
14+
15+
obj = cont.object_from_array('region_example_obj', data)
16+
17+
data1 = obj.get_data(pdc.region[:2]).wait() # [[2, 7, 6], [9, 5, 1]]
18+
assert np.array_equal(data1, [[2, 7, 6], [9, 5, 1]])
19+
data2 = obj.get_data(pdc.region[0, :2]).wait() # [[2, 7]]
20+
assert np.array_equal(data2, [[2, 7]])

0 commit comments

Comments
 (0)