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.
This commit is contained in:
Drew Risinger 2019-01-09 12:33:51 -05:00
parent 01521b5ed0
commit 5108ed8da8
1 changed files with 12 additions and 5 deletions

View File

@ -100,13 +100,15 @@ class RPCCase(unittest.TestCase):
""" """
def _annotated_function( def _annotated_function(
arg1: str, arg2: np.ndarray = np.array([1,]) arg1: str, arg2: np.ndarray = np.array([1, 2])
) -> np.ndarray: ) -> np.ndarray:
"""Sample docstring.""" """Sample docstring."""
return arg1 return arg1
argspec, docstring = pc_rpc.Server._document_function(_annotated_function) argspec_documented, docstring = pc_rpc.Server._document_function(
print(argspec) # for debug _annotated_function
)
print(argspec_documented)
self.assertEqual(docstring, "Sample docstring.") self.assertEqual(docstring, "Sample docstring.")
# purposefully ignore how argspec["annotations"] is treated. # purposefully ignore how argspec["annotations"] is treated.
@ -115,8 +117,13 @@ class RPCCase(unittest.TestCase):
argspec_without_annotation = argspec_master.copy() argspec_without_annotation = argspec_master.copy()
del argspec_without_annotation["annotations"] del argspec_without_annotation["annotations"]
# check if all items (excluding annotations) are same in both dictionaries # check if all items (excluding annotations) are same in both dictionaries
self.assertLessEqual(argspec_without_annotation.items(), argspec.items()) self.assertLessEqual(
self.assertDictEqual(argspec, pyon.decode(pyon.encode(argspec))) argspec_without_annotation.items(), argspec_documented.items()
)
self.assertDictEqual(
argspec_documented, pyon.decode(pyon.encode(argspec_documented))
)
class FireAndForgetCase(unittest.TestCase): class FireAndForgetCase(unittest.TestCase):
def _set_ok(self): def _set_ok(self):