Last active
August 29, 2015 13:57
-
-
Save moea/9766808 to your computer and use it in GitHub Desktop.
Test Style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# instead of | |
userColl = (yield client.getUserCollection())._coll | |
self.assertEqual(userColl[0]['userID'],"TestUser") | |
self.assertEqual(len(userColl[0]['userDeviceAddresses']),2) | |
self.assertTrue(userColl[0]['userDeviceAddresses'][0]=="DD:DD:DD:DD" or userColl[0]['userDeviceAddresses'][1]=="DD:DD:DD:DD")· | |
# i would go with something like | |
(userColl,) = (yield client.getUserCollection())._coll # will assign _coll[0] to userColl and explode unless there is exactly one item | |
self.assertEqual(userColl['userID'], 'TestUser') # consistent use of either single or double quotes | |
self.assertEqual(sorted(userColl['userDeviceAddress']), ['AA:AA...', 'DD:DD...']) # more managable than checking each element as above, and checks that both are in there. | |
# here i'd probably assert something about the timestamp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment