Exemplo n.º 1
0
    def test_badinput(self, pick_patch, qapppatch):
        imppick.sys.argv = ['dummy']
        argparse_mock = MagicMock()
        with patch('argparse.ArgumentParser._print_message', argparse_mock):
            with self.assertRaises(BaseException):
                imppick.main()

        imppick.sys.argv = ['dummy', '-xd']
        argparse_mock = MagicMock()
        with patch('argparse.ArgumentParser._print_message', argparse_mock):
            with self.assertRaises(BaseException):
                imppick.main()

        imppick.sys.argv = ['dummy', '-yd']
        argparse_mock = MagicMock()
        with patch('argparse.ArgumentParser._print_message', argparse_mock):
            with self.assertRaises(BaseException):
                imppick.main()

        imppick.sys.argv = ['dummy', '-xd', '-yd']
        argparse_mock = MagicMock()
        with patch('argparse.ArgumentParser._print_message', argparse_mock):
            with self.assertRaises(BaseException):
                imppick.main()

        imppick.sys.argv = ['dummy', 'fn', 'fn2']
        argparse_mock = MagicMock()
        with patch('argparse.ArgumentParser._print_message', argparse_mock):
            with self.assertRaises(BaseException):
                imppick.main()
Exemplo n.º 2
0
 def test_pick_distsnum(self, load_patch, pick_patch, qapppatch):
     load_patch.return_value = [MagicMock()]
     imppick.sys.argv = ['dummy', 'fn', '-xd']
     # this is supposed to exit when finished
     with self.assertRaises(SystemExit):
         imppick.main()
     self.assertTrue(load_patch.called)
     load_patch.asseert_called_with('mat', ['fn'])
     self.assertTrue(pick_patch.called)
     pick_patch.assert_called_with(load_patch.return_value[0],
                                   xdat='dist',
                                   ydat='twtt')
Exemplo n.º 3
0
    def test_pick_tnumdepth(self, load_patch, pick_patch, qapppatch):
        load_patch.return_value = [MagicMock()]
        imppick.sys.argv = ['dummy', 'fn', '-yd']
        # this is supposed to exit when finished
        argparse_mock = MagicMock()
        with patch('argparse.ArgumentParser._print_message', argparse_mock):
            with self.assertRaises(SystemExit):
                imppick.main()

        self.assertTrue(load_patch.called)
        load_patch.asseert_called_with('mat', ['fn'])
        self.assertTrue(pick_patch.called)
        pick_patch.assert_called_with(load_patch.return_value[0],
                                      xdat='tnum',
                                      ydat='depth')
Exemplo n.º 4
0
    def test_badinput(self, pick_patch, qapppatch):
        imppick.sys.argv = ['dummy']
        with self.assertRaises(BaseException):
            imppick.main()

        imppick.sys.argv = ['dummy', '-xd']
        with self.assertRaises(BaseException):
            imppick.main()

        imppick.sys.argv = ['dummy', '-yd']
        with self.assertRaises(BaseException):
            imppick.main()

        imppick.sys.argv = ['dummy', '-xd', '-yd']
        with self.assertRaises(BaseException):
            imppick.main()

        imppick.sys.argv = ['dummy', 'fn', 'fn2']
        with self.assertRaises(BaseException):
            imppick.main()