From 5d647cf9a6159afd2933da594b9c79ad93d3cd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= Date: Mon, 23 Dec 2019 13:45:09 +0100 Subject: New upstream version 0.12.0~b0+dfsg --- silx/io/test/test_dictdump.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'silx/io/test/test_dictdump.py') 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): -- cgit v1.2.3