From 5108ed8da82cbc05a66db9d04451ebbad8d9b061 Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Wed, 9 Jan 2019 12:33:51 -0500 Subject: [PATCH] test_pc_rpc: clarify test and remove comment Removed comment per @sbourdeauducq. Clarify variable names b/c they didn't make sense when re-reading months later. --- artiq/test/test_pc_rpc.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/artiq/test/test_pc_rpc.py b/artiq/test/test_pc_rpc.py index 94da01d39..2a3c3e866 100644 --- a/artiq/test/test_pc_rpc.py +++ b/artiq/test/test_pc_rpc.py @@ -100,13 +100,15 @@ class RPCCase(unittest.TestCase): """ def _annotated_function( - arg1: str, arg2: np.ndarray = np.array([1,]) + arg1: str, arg2: np.ndarray = np.array([1, 2]) ) -> np.ndarray: """Sample docstring.""" return arg1 - argspec, docstring = pc_rpc.Server._document_function(_annotated_function) - print(argspec) # for debug + argspec_documented, docstring = pc_rpc.Server._document_function( + _annotated_function + ) + print(argspec_documented) self.assertEqual(docstring, "Sample docstring.") # purposefully ignore how argspec["annotations"] is treated. @@ -115,8 +117,13 @@ class RPCCase(unittest.TestCase): argspec_without_annotation = argspec_master.copy() del argspec_without_annotation["annotations"] # check if all items (excluding annotations) are same in both dictionaries - self.assertLessEqual(argspec_without_annotation.items(), argspec.items()) - self.assertDictEqual(argspec, pyon.decode(pyon.encode(argspec))) + self.assertLessEqual( + argspec_without_annotation.items(), argspec_documented.items() + ) + self.assertDictEqual( + argspec_documented, pyon.decode(pyon.encode(argspec_documented)) + ) + class FireAndForgetCase(unittest.TestCase): def _set_ok(self):