@@ -2422,32 +2422,34 @@ def assert_downloaded_file(self, file):
2422
2422
self .driver , messenger_post , self .message_duration )
2423
2423
2424
2424
def assert_true (self , expr , msg = None ):
2425
+ """ Asserts that the expression is True.
2426
+ Will raise an exception if the statement if False. """
2425
2427
self .assertTrue (expr , msg = msg )
2426
- '''if self.demo_mode:
2427
- messenger_post = ("ASSERT TRUE (See code)")
2428
- js_utils.post_messenger_success_message(
2429
- self.driver, messenger_post, self.message_duration)'''
2430
2428
2431
2429
def assert_false (self , expr , msg = None ):
2430
+ """ Asserts that the expression is False.
2431
+ Will raise an exception if the statement if True. """
2432
2432
self .assertFalse (expr , msg = msg )
2433
- '''if self.demo_mode:
2434
- messenger_post = ("ASSERT FALSE (See code)")
2435
- js_utils.post_messenger_success_message(
2436
- self.driver, messenger_post, self.message_duration)'''
2437
2433
2438
2434
def assert_equal (self , first , second , msg = None ):
2435
+ """ Asserts that the two values are equal.
2436
+ Will raise an exception if the values are not equal. """
2439
2437
self .assertEqual (first , second , msg = msg )
2440
- '''if self.demo_mode:
2441
- messenger_post = ("ASSERT EQUAL: {%s == %s}" % (first, second))
2442
- js_utils.post_messenger_success_message(
2443
- self.driver, messenger_post, self.message_duration)'''
2444
2438
2445
2439
def assert_not_equal (self , first , second , msg = None ):
2440
+ """ Asserts that the two values are not equal.
2441
+ Will raise an exception if the values are equal. """
2446
2442
self .assertNotEqual (first , second , msg = msg )
2447
- '''if self.demo_mode:
2448
- messenger_post = ("ASSERT NOT EQUAL: {%s != %s}" % (first, second))
2449
- js_utils.post_messenger_success_message(
2450
- self.driver, messenger_post, self.message_duration)'''
2443
+
2444
+ def assert_raises (self , * args , ** kwargs ):
2445
+ """ Asserts that the following block of code raises an exception.
2446
+ Will raise an exception if the block of code has no exception.
2447
+ Usage Example =>
2448
+ # Verify that the expected exception is raised.
2449
+ with self.assert_raises(Exception):
2450
+ raise Exception("Expected Exception!")
2451
+ """
2452
+ self .assertRaises (* args , ** kwargs )
2451
2453
2452
2454
def assert_title (self , title ):
2453
2455
""" Asserts that the web page title matches the expected title. """
0 commit comments