summaryrefslogtreecommitdiff
path: root/silx/io/test/test_dictdump.py
diff options
context:
space:
mode:
authorPicca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>2019-12-23 13:45:09 +0100
committerPicca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>2019-12-23 13:45:09 +0100
commit7ee2fd39b83af94e061ade2a2dac2a6918ac0a07 (patch)
tree720c4f64d9d7b6260f1979f0f4ff188a0b379f1f /silx/io/test/test_dictdump.py
parent6f3cf570afab1005f81793c83b7ba5766c7c5bab (diff)
parent5d647cf9a6159afd2933da594b9c79ad93d3cd9b (diff)
Update upstream source from tag 'upstream/0.12.0_b0+dfsg'
Update to upstream version '0.12.0~b0+dfsg' with Debian dir 92f448758e24d5e4b53a9474665fea15b0286295
Diffstat (limited to 'silx/io/test/test_dictdump.py')
-rw-r--r--silx/io/test/test_dictdump.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/silx/io/test/test_dictdump.py b/silx/io/test/test_dictdump.py
index ab8161d..12e13f5 100644
--- a/silx/io/test/test_dictdump.py
+++ b/silx/io/test/test_dictdump.py
@@ -1,6 +1,6 @@
# coding: utf-8
# /*##########################################################################
-# Copyright (C) 2016-2017 European Synchrotron Radiation Facility
+# Copyright (C) 2016-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -49,9 +49,11 @@ def tree():
return defaultdict(tree)
+inhabitants = 160215
+
city_attrs = tree()
city_attrs["Europe"]["France"]["Grenoble"]["area"] = "18.44 km2"
-city_attrs["Europe"]["France"]["Grenoble"]["inhabitants"] = 160215
+city_attrs["Europe"]["France"]["Grenoble"]["inhabitants"] = inhabitants
city_attrs["Europe"]["France"]["Grenoble"]["coordinates"] = [45.1830, 5.7196]
city_attrs["Europe"]["France"]["Tourcoing"]["area"]
@@ -129,6 +131,16 @@ class TestH5ToDict(unittest.TestCase):
self.assertIn("coordinates", ddict["Grenoble"])
self.assertIn("area", ddict["Grenoble"])
+ def testAsArrayTrue(self):
+ """Test with asarray=True, the default"""
+ ddict = h5todict(self.h5_fname, path="/Europe/France/Grenoble")
+ self.assertTrue(numpy.array_equal(ddict["inhabitants"], numpy.array(inhabitants)))
+
+ def testAsArrayFalse(self):
+ """Test with asarray=False"""
+ ddict = h5todict(self.h5_fname, path="/Europe/France/Grenoble", asarray=False)
+ self.assertEqual(ddict["inhabitants"], inhabitants)
+
class TestDictToJson(unittest.TestCase):
def setUp(self):