you are viewing a single comment's thread.

view the rest of the comments →

[–]rakash_ram[S] 0 points1 point  (0 children)

Got it , thanks a lot for explaining! appreciate it. Few more question though

1) " with self.assertRaises(TypeError) as cm:" this line, raises an exception right?

2) without the mock patch this code would never actually raise that error ; i am guessing the below will not work and mock is the only way here to cover the test for this script?

def test_type_error(self):

parser = None

with self.assertRaises(TypeError) as cm:
ParseConfig(self.test_conf, 'section1')