mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Convert to unittest.py.
This commit is contained in:
parent
b1c26c7509
commit
e9d04fcf4b
1 changed files with 17 additions and 20 deletions
|
@ -1,31 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
# Written by Shlomi Fish, under the MIT Expat License.
|
||||
|
||||
# imports
|
||||
import sys
|
||||
from TAP.Simple import plan, ok
|
||||
|
||||
import unittest
|
||||
from pysollib.acard import AbstractCard
|
||||
|
||||
|
||||
def shlomif_main(args):
|
||||
class MyTests(unittest.TestCase):
|
||||
def test_cards(self):
|
||||
card1 = AbstractCard(1001, 0, 1, 2, 3001)
|
||||
# TEST
|
||||
self.assertEqual(card1.color, 0, 'card1.color is sane.')
|
||||
|
||||
plan(4)
|
||||
# TEST
|
||||
self.assertEqual(card1.rank, 2, 'card1.rank')
|
||||
|
||||
card1 = AbstractCard(1001, 0, 1, 2, 3001)
|
||||
# TEST
|
||||
ok(card1.color == 0, 'card1.color is sane.')
|
||||
card2 = AbstractCard(1001, 0, 3, 7, 3001)
|
||||
# TEST
|
||||
self.assertEqual(card2.color, 1, 'card2.color is sane.')
|
||||
|
||||
# TEST
|
||||
ok(card1.rank == 2, 'card1.rank')
|
||||
|
||||
card2 = AbstractCard(1001, 0, 3, 7, 3001)
|
||||
# TEST
|
||||
ok(card2.color == 1, 'card2.color is sane.')
|
||||
|
||||
# TEST
|
||||
ok(card2.rank == 7, 'card2.rank')
|
||||
# TEST
|
||||
self.assertEqual(card2.rank, 7, 'card2.rank')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(shlomif_main(sys.argv))
|
||||
if __name__ == '__main__':
|
||||
from pycotap import TAPTestRunner
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(MyTests)
|
||||
TAPTestRunner().run(suite)
|
||||
|
|
Loading…
Add table
Reference in a new issue