1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

convert to unittest

This commit is contained in:
Shlomi Fish 2018-03-19 15:46:26 +02:00
parent 21b0360197
commit 3e9a071926

View file

@ -1,31 +1,28 @@
#!/usr/bin/env python3
# Written by Shlomi Fish, under the MIT Expat License.
# imports
import sys
from TAP.Simple import diag, plan, ok
import unittest
from pysollib.acard import AbstractCard
from pysollib.hint import Base_Solver_Hint
def shlomif_main(args):
class MyTests(unittest.TestCase):
def test_output(self):
card = AbstractCard(1001, 0, 3, 7, 3001)
h = Base_Solver_Hint(None, None, base_rank=0)
plan(2)
got = h.card2str2(card)
# TEST
self.assertEqual(got, 'D-8', 'card2str2 works')
# diag('got == ' + got)
card = AbstractCard(1001, 0, 3, 7, 3001)
h = Base_Solver_Hint(None, None, base_rank=0)
got = h.card2str2(card)
# TEST
if not ok(got == 'D-8', 'card2str2 works'):
diag('got == ' + got)
got = h.card2str1(card)
# TEST
if not ok(got == '8D', 'card2str1 works'):
diag('got == ' + got)
got = h.card2str1(card)
# TEST
self.assertEqual(got, '8D', 'card2str2 works')
# diag('got == ' + got)
if __name__ == "__main__":
sys.exit(shlomif_main(sys.argv))
if __name__ == '__main__':
from pycotap import TAPTestRunner
suite = unittest.TestLoader().loadTestsFromTestCase(MyTests)
TAPTestRunner().run(suite)