Browse Source

Merge "Replace 'assertTrue(a (not)in b)' with 'assert(Not)In(a, b)'"

Jenkins 2 years ago
parent
commit
73b969cb3d
1 changed files with 16 additions and 16 deletions
  1. 16
    16
      mox3/tests/test_mox.py

+ 16
- 16
mox3/tests/test_mox.py View File

@@ -764,7 +764,7 @@ class MockAnythingTest(testtools.TestCase):
764 764
 
765 765
     def testIsReprable(self):
766 766
         """Test that MockAnythings can be repr'd without causing a failure."""
767
-        self.assertTrue('MockAnything' in repr(self.mock_object))
767
+        self.assertIn('MockAnything', repr(self.mock_object))
768 768
 
769 769
 
770 770
 class MethodCheckerTest(testtools.TestCase):
@@ -961,27 +961,27 @@ class MockObjectTest(testtools.TestCase):
961 961
 
962 962
     def testFindValidMethods(self):
963 963
         """Mock should be able to mock all public methods."""
964
-        self.assertTrue('ValidCall' in self.mock_object._known_methods)
965
-        self.assertTrue('OtherValidCall' in self.mock_object._known_methods)
966
-        self.assertTrue('MyClassMethod' in self.mock_object._known_methods)
967
-        self.assertTrue('MyStaticMethod' in self.mock_object._known_methods)
968
-        self.assertTrue('_ProtectedCall' in self.mock_object._known_methods)
969
-        self.assertTrue('__PrivateCall' not in self.mock_object._known_methods)
970
-        self.assertTrue(
971
-            '_TestClass__PrivateCall' in self.mock_object._known_methods)
964
+        self.assertIn('ValidCall', self.mock_object._known_methods)
965
+        self.assertIn('OtherValidCall', self.mock_object._known_methods)
966
+        self.assertIn('MyClassMethod', self.mock_object._known_methods)
967
+        self.assertIn('MyStaticMethod', self.mock_object._known_methods)
968
+        self.assertIn('_ProtectedCall', self.mock_object._known_methods)
969
+        self.assertNotIn('__PrivateCall', self.mock_object._known_methods)
970
+        self.assertIn(
971
+            '_TestClass__PrivateCall', self.mock_object._known_methods)
972 972
 
973 973
     def testFindsSuperclassMethods(self):
974 974
         """Mock should be able to mock superclasses methods."""
975 975
         self.mock_object = mox.MockObject(ChildClass)
976
-        self.assertTrue('ValidCall' in self.mock_object._known_methods)
977
-        self.assertTrue('OtherValidCall' in self.mock_object._known_methods)
978
-        self.assertTrue('MyClassMethod' in self.mock_object._known_methods)
979
-        self.assertTrue('ChildValidCall' in self.mock_object._known_methods)
976
+        self.assertIn('ValidCall', self.mock_object._known_methods)
977
+        self.assertIn('OtherValidCall', self.mock_object._known_methods)
978
+        self.assertIn('MyClassMethod', self.mock_object._known_methods)
979
+        self.assertIn('ChildValidCall', self.mock_object._known_methods)
980 980
 
981 981
     def testAccessClassVariables(self):
982 982
         """Class variables should be accessible through the mock."""
983
-        self.assertTrue('SOME_CLASS_VAR' in self.mock_object._known_vars)
984
-        self.assertTrue('_PROTECTED_CLASS_VAR' in self.mock_object._known_vars)
983
+        self.assertIn('SOME_CLASS_VAR', self.mock_object._known_vars)
984
+        self.assertIn('_PROTECTED_CLASS_VAR', self.mock_object._known_vars)
985 985
         self.assertEqual('test_value', self.mock_object.SOME_CLASS_VAR)
986 986
 
987 987
     def testEquals(self):
@@ -1183,7 +1183,7 @@ class MockObjectTest(testtools.TestCase):
1183 1183
 
1184 1184
         dummy._Replay()
1185 1185
 
1186
-        self.assertTrue('X' in dummy)
1186
+        self.assertIn('X', dummy)
1187 1187
 
1188 1188
         dummy._Verify()
1189 1189
 

Loading…
Cancel
Save