diff options
author | David James <davidjames@google.com> | 2015-03-23 10:07:00 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-03-24 04:00:09 +0000 |
commit | 666c73271a2c16ac8e7418e69880408493fcac08 (patch) | |
tree | b3dd4f99814fd345444708b7cf7785fc671a3386 /cbuildbot/cbuildbot_config_unittest.py | |
parent | 785cb2b424efc25cbcfc7064929342f663f24386 (diff) | |
download | chromite-666c73271a2c16ac8e7418e69880408493fcac08.tar.gz |
cbuildbot_config: Clean up deepcopy a bit.
- Clean up comments.
- Use assertIs / assertIsNot in unit tests.
BUG=chromium:468916
TEST=Unit tests pass. Dump is unmodified.
Change-Id: I1c4f82cd2531efeaff10c4d6655daded02dd77ce
Reviewed-on: https://chromium-review.googlesource.com/261848
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Trybot-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Diffstat (limited to 'cbuildbot/cbuildbot_config_unittest.py')
-rw-r--r-- | cbuildbot/cbuildbot_config_unittest.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cbuildbot/cbuildbot_config_unittest.py b/cbuildbot/cbuildbot_config_unittest.py index 8b063e13e..525aa79f6 100644 --- a/cbuildbot/cbuildbot_config_unittest.py +++ b/cbuildbot/cbuildbot_config_unittest.py @@ -129,10 +129,10 @@ class ConfigClassTest(cros_test_lib.TestCase): obj2: A true deep copy of obj1 (produced using copy.deepcopy). obj3: The purported deep copy of obj1. """ - # Objects that are hashable are guaranteed to be immutable. - # If an object is not hashable, it needs to be deeply copied. + # Check whether the item was copied by deepcopy. If so, then it + # must have been copied by our algorithm as well. if obj1 is not obj2: - self.assertTrue(obj1 is not obj3, '%r vs. %r' % (obj1, obj3)) + self.assertIsNot(obj1, obj3) # Assert the three items are all equal. self.assertEqual(obj1, obj2) @@ -159,8 +159,10 @@ class ConfigClassTest(cros_test_lib.TestCase): self.AssertDeepCopy(getattr(obj1, attr), getattr(obj2, attr), getattr(obj3, attr)) else: - # This should be an immutable object. - self.assertTrue(obj1 is obj2) + # This should be an object that copy.deepcopy didn't copy (probably an + # immutable object.) If not, the test needs to be updated to handle this + # kind of object. + self.assertIs(obj1, obj2) def testDeepCopy(self): """Test that we deep copy correctly.""" |