コード例 #1
0
ファイル: bin2tap.py プロジェクト: TitsMagee/skoolkit
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright 2012-2013 Richard Dymond ([email protected])
#
# This file is part of SkoolKit.
#
# SkoolKit is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# SkoolKit is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# SkoolKit. If not, see <http://www.gnu.org/licenses/>.

import sys

from skoolkit import bin2tap, error, SkoolKitError

try:
    bin2tap.main(sys.argv[1:])
except SkoolKitError as e:
    error(e.args[0])
コード例 #2
0
 def test_error(self):
     message = 'Something went wrong'
     with self.assertRaises(SystemExit) as cm:
         error(message)
     self.assertEqual(cm.exception.args[0], 1)
     self.assertEqual(self.err.getvalue(), 'ERROR: {0}\n'.format(message))
コード例 #3
0
#!/usr/bin/env python3

# Copyright 2012-2013, 2017 Richard Dymond ([email protected])
#
# This file is part of SkoolKit.
#
# SkoolKit is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# SkoolKit is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# SkoolKit. If not, see <http://www.gnu.org/licenses/>.

import sys

from skoolkit import skool2asm, error, SkoolKitError

try:
    skool2asm.main(sys.argv[1:])
except SkoolKitError as e:
    error(e.args[0])
コード例 #4
0
ファイル: test_skoolkit.py プロジェクト: TitsMagee/skoolkit
 def test_error(self):
     message = 'Something went wrong'
     with self.assertRaises(SystemExit) as cm:
         error(message)
     self.assertEqual(cm.exception.args[0], 1)
     self.assertEqual(self.err.getvalue(), 'ERROR: {0}\n'.format(message))