From de3f65975955ce08739629173c36ae415ae8ecaa Mon Sep 17 00:00:00 2001 From: mili1247 <76153746+mili1247@users.noreply.github.com> Date: Fri, 18 Dec 2020 09:16:45 +0100 Subject: [PATCH] tests: Add check for to_dict() Co-authored-by: Riccardo Frenner --- testsuite/python/particle.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testsuite/python/particle.py b/testsuite/python/particle.py index cf56ce1df22..b1d0e7cf262 100644 --- a/testsuite/python/particle.py +++ b/testsuite/python/particle.py @@ -377,6 +377,16 @@ def test_particle_slice(self): with self.assertRaises(TypeError): system.part[[ids[0], 1.2]] + def test_to_dict(self): + self.system.part.clear() + p = self.system.part.add( + pos=np.random.uniform(size=(10, 3)) * self.system.box_l) + pp = str(p) + pdict = p.to_dict() + p.remove() + self.system.part.add(pdict) + self.assertEqual(str(self.system.part.select()), pp) + if __name__ == "__main__": ut.main()