Skip to content

Commit

Permalink
Update tests with recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jgray-19 committed Jan 24, 2024
1 parent eb6bc8a commit 8fc8bd1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
12 changes: 6 additions & 6 deletions tests/comm_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
27 changes: 14 additions & 13 deletions tests/obj_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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)]
Expand Down

0 comments on commit 8fc8bd1

Please sign in to comment.