
import unittest

import git_mnemonic as gm

class GitMnemonicTests(unittest.TestCase):
    def test_encode(self):
        self.assertTrue(gm.encode("master"))

    def test_decode(self):
        self.assertTrue(gm.decode("bis alo ama aha"))

    def test_invertible(self):
        once = gm.encode("master")
        self.assertEquals(gm.encode(gm.decode(once)), once)

if __name__ == '__main__':
    unittest.main(verbosity=2)

import unittest

import git_mnemonic as gm

class GitMnemonicTests(unittest.TestCase):
    def test_encode(self):
        self.assertTrue(gm.encode("master"))

    def test_decode(self):
        self.assertTrue(gm.decode("bis alo ama aha"))

    def test_invertible(self):
        once = gm.encode("master")
        self.assertEquals(gm.encode(gm.decode(once)), once)

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(GitMnemonicTests)
    results = unittest.TextTestRunner(verbosity=2).run(suite)
    if not results.wasSuccessful():
        import sys
        sys.exit(1)
Make unittest test runner work in older pythons
Make unittest test runner work in older pythons

  
  import unittest
  
  import git_mnemonic as gm
  
  class GitMnemonicTests(unittest.TestCase):
      def test_encode(self):
          self.assertTrue(gm.encode("master"))
  
      def test_decode(self):
          self.assertTrue(gm.decode("bis alo ama aha"))
  
      def test_invertible(self):
          once = gm.encode("master")
          self.assertEquals(gm.encode(gm.decode(once)), once)
  
  if __name__ == '__main__':
-     unittest.main(verbosity=2)
+     suite = unittest.TestLoader().loadTestsFromTestCase(GitMnemonicTests)
+     results = unittest.TextTestRunner(verbosity=2).run(suite)
+     if not results.wasSuccessful():
+         import sys
+         sys.exit(1)
Make unittest test runner work in older pythons
## Code Before:

import unittest

import git_mnemonic as gm

class GitMnemonicTests(unittest.TestCase):
    def test_encode(self):
        self.assertTrue(gm.encode("master"))

    def test_decode(self):
        self.assertTrue(gm.decode("bis alo ama aha"))

    def test_invertible(self):
        once = gm.encode("master")
        self.assertEquals(gm.encode(gm.decode(once)), once)

if __name__ == '__main__':
    unittest.main(verbosity=2)
## Instruction:
Make unittest test runner work in older pythons
## Code After:

import unittest

import git_mnemonic as gm

class GitMnemonicTests(unittest.TestCase):
    def test_encode(self):
        self.assertTrue(gm.encode("master"))

    def test_decode(self):
        self.assertTrue(gm.decode("bis alo ama aha"))

    def test_invertible(self):
        once = gm.encode("master")
        self.assertEquals(gm.encode(gm.decode(once)), once)

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(GitMnemonicTests)
    results = unittest.TextTestRunner(verbosity=2).run(suite)
    if not results.wasSuccessful():
        import sys
        sys.exit(1)