@@ -717,6 +717,35 @@ def test_categorical_equal_message(self):
717
717
tm .assert_categorical_equal (a , b )
718
718
719
719
720
+ class TestAssertNot (object ):
721
+
722
+ def test_assert_not_succeed (self ):
723
+ a = pd .DataFrame ([1 , 2 ])
724
+ b = pd .DataFrame ([1 , 2 , 3 ])
725
+ tm .assert_not (tm .assert_frame_equal , a , b )
726
+
727
+ a = np .array ([1 , 2 , 3 ], dtype = np .int64 )
728
+ b = np .array ([1 , 2 , 3 ], dtype = np .int32 )
729
+ tm .assert_not (tm .assert_numpy_array_equal , a , b )
730
+
731
+ def test_assert_not_fail (self ):
732
+ a = pd .DataFrame ([1 , 2 , 3 ])
733
+ b = pd .DataFrame ([1 , 2 , 3 ])
734
+
735
+ msg = ("Assertion function \' assert_frame_equal\' "
736
+ "succeeded when expected to fail" )
737
+ with tm .assert_raises_regex (AssertionError , msg ):
738
+ tm .assert_not (tm .assert_frame_equal , a , b )
739
+
740
+ a = pd .Categorical ([1 , 2 , 3 , 4 ])
741
+ b = pd .Categorical ([1 , 2 , 3 , 4 ])
742
+
743
+ msg = ("Assertion function \' assert_categorical_equal\' "
744
+ "succeeded when expected to fail" )
745
+ with tm .assert_raises_regex (AssertionError , msg ):
746
+ tm .assert_not (tm .assert_categorical_equal , a , b )
747
+
748
+
720
749
class TestRNGContext (object ):
721
750
722
751
def test_RNGContext (self ):
0 commit comments