コード例 #1
0
    def test_another_function_dryrun_on(self):
        drypy.set_dryrun(True)
        result = another_function(1, 2)
        self.assertEqual(result, 321)

        # check that sheriff result is equal to deputy result
        deputy_result = dryrun_another_function(1, 2)
        self.assertEqual(result, deputy_result)
コード例 #2
0
    def test_a_sheriff_deputy_dryrun_on(self):
        drypy.set_dryrun(True)
        an_instance = AClass()
        result = an_instance.a_sheriff('world')
        self.assertEqual(result, "goodbye world ..")

        # deputy result must be the sheriff result
        deputy_result = an_instance.a_sheriff_deputy('zxc')
        self.assertEqual(deputy_result, result)
コード例 #3
0
    def test_a_sheriff_deputy_dryrun_off(self):
        drypy.set_dryrun(False)
        an_instance = AClass()
        result = an_instance.a_sheriff('world')
        self.assertEqual(result, 'hello world')

        # check also the deputy in order to verify it is still callable
        deputy_result = an_instance.a_sheriff_deputy('zxc')
        self.assertEqual(deputy_result, "goodbye world ..")
コード例 #4
0
 def test_dryrun_toggle_from_on(self):
     drypy.set_dryrun(True)
     drypy.toggle_dryrun()
     self.assertEqual(drypy.get_status(), False)
コード例 #5
0
 def test_dryrun_set_off(self):
     drypy.set_dryrun(False)
     self.assertEqual(drypy.get_status(), False)
コード例 #6
0
 def test_dryrun_set_on(self):
     drypy.set_dryrun(True)
     self.assertEqual(drypy.get_status(), True)
コード例 #7
0
 def test_a_sheriff_which_fallbacks_to_sham_dryrun_on(self):
     drypy.set_dryrun(True)
     an_instance = AClass()
     result = an_instance.a_sheriff_which_fallbacks_to_sham(40, 2)
     self.assertEqual(result, None)
コード例 #8
0
 def test_sheriff_fallback_sham_dryrun_on(self):
     drypy.set_dryrun(True)
     self.assertEqual(a_sheriff_which_fallbacks_to_sham(42), None)
コード例 #9
0
    def test_another_function_dryrun_off(self):
        drypy.set_dryrun(False)
        self.assertEqual(another_function(1, 2), 123)

        # check that deputy function is still callable
        self.assertEqual(dryrun_another_function(1, 2), 321)
コード例 #10
0
 def test_sheriff_fallback_sham_dryrun_off(self):
     drypy.set_dryrun(False)
     self.assertEqual(a_sheriff_which_fallbacks_to_sham(42), 'truth!')
コード例 #11
0
 def test_a_method_dryrun_on(self):
     drypy.set_dryrun(True)
     an_instance = AClass()
     self.assertEqual(an_instance.a_method(10, 2), None)
コード例 #12
0
 def test_a_method_dryrun_off(self):
     drypy.set_dryrun(False)
     an_instance = AClass()
     self.assertEqual(an_instance.a_method(10, 2), 20)
コード例 #13
0
 def test_a_function_dryrun_on(self):
     drypy.set_dryrun(True)
     self.assertEqual(a_function(), None)
コード例 #14
0
 def test_a_function_dryrun_off(self):
     drypy.set_dryrun(False)
     self.assertEqual(a_function(), True)