From 8fc8bd1baacabf33a39df8735d4f5e5b95785486 Mon Sep 17 00:00:00 2001 From: jgray-19 Date: Wed, 24 Jan 2024 22:40:26 +0000 Subject: [PATCH] Update tests with recent changes --- tests/comm_tests.py | 12 ++++++------ tests/obj_tests.py | 27 ++++++++++++++------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/tests/comm_tests.py b/tests/comm_tests.py index 9ce3e47..e294b4d 100644 --- a/tests/comm_tests.py +++ b/tests/comm_tests.py @@ -87,10 +87,10 @@ def test_send_recv_wref(self): list1 = mad.recv("list") list2 = mad.recv("list2") self.assertEqual(len(list1), 2) - self.assertEqual(list2[0], [1, 2, 3, 4, 5]) - self.assertEqual(list2[1].a, 10) - self.assertEqual(list2[1].b, 3) - self.assertEqual(list2[1].c, 4) + self.assertEqual([x for x in list2], [1, 2, 3, 4, 5]) + self.assertEqual(list2["a"], 10) + self.assertEqual(list2["b"], 3) + self.assertEqual(list2["c"], 4) self.assertEqual(list1[0].a, 2) self.assertEqual(list1[1].b, 2) @@ -318,7 +318,7 @@ def test_recv_cpx(self): def test_send_tpsa(self): with MAD() as mad: mad.send(""" - local tab = py:recv() + tab = py:recv() py:send(tab) """) monos = np.asarray([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [2, 0, 0], [1, 1, 0]], dtype=np.uint8) @@ -329,7 +329,7 @@ def test_send_tpsa(self): def test_send_ctpsa(self): with MAD() as mad: mad.send(""" - local tab = py:recv() + tab = py:recv() py:send(tab) """) monos = np.asarray([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [2, 0, 0], [1, 1, 0]], dtype=np.uint8) diff --git a/tests/obj_tests.py b/tests/obj_tests.py index ec456c8..4ab3e16 100644 --- a/tests/obj_tests.py +++ b/tests/obj_tests.py @@ -336,16 +336,17 @@ def generalDataFrame(self, headers, DataFrame): ) df = mad.test.to_df() self.assertTrue(isinstance(df, DataFrame)) - self.assertEqual(getattr(df, headers)["name"], "test") - self.assertEqual(getattr(df, headers)["string"], "string") - self.assertEqual(getattr(df, headers)["number"], 1.234567890) - self.assertEqual(getattr(df, headers)["integer"], 12345670) - self.assertEqual(getattr(df, headers)["complex"], 1.3 + 1.2j) - self.assertEqual(getattr(df, headers)["boolean"], True) - self.assertEqual(getattr(df, headers)["list"], [1, 2, 3, 4, 5]) - lst, hsh = getattr(df, headers)["table"] - self.assertEqual(lst, [1, 2]) - self.assertEqual(hsh["key"], "value") + header = getattr(df, headers) + self.assertEqual(header["name"], "test") + self.assertEqual(header["string"], "string") + self.assertEqual(header["number"], 1.234567890) + self.assertEqual(header["integer"], 12345670) + self.assertEqual(header["complex"], 1.3 + 1.2j) + self.assertEqual(header["boolean"], True) + self.assertEqual(header["list"], [1, 2, 3, 4, 5]) + tbl = getattr(df, headers)["table"] + self.assertEqual([x for x in tbl], [1, 2]) + self.assertEqual(tbl["key"], "value") self.assertEqual(df["string"].tolist(), ["a", "b", "c", "d", "e"]) self.assertEqual(df["number"].tolist(), [1.1, 2.2, 3.3, 4.4, 5.5]) @@ -355,9 +356,9 @@ def generalDataFrame(self, headers, DataFrame): self.assertEqual(df["list"].tolist(), [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) tbl = df["table"].tolist() for i in range(len(tbl)): - lst, hsh = tbl[i] - self.assertEqual(lst, [i*3 + 1, i*3 + 2]) - self.assertEqual(hsh[str((i+1) * 3)], (i+1) * 3) + lst = tbl[i] + self.assertEqual([lst[0], lst[1]], [i*3 + 1, i*3 + 2]) + self.assertEqual(lst[str((i+1) * 3)], (i+1) * 3) self.assertEqual( df["range"].tolist(), [range(1, 12), range(2, 13), range(3, 14), range(4, 15), range(5, 16)]