
import unittest
from mbed_greentea import mbed_greentea_cli

class GreenteaCliFunctionality(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_print_version(self):
        version = mbed_greentea_cli.print_version(verbose=False)
        a, b, c = version.split('.')
        self.assertEqual(a.isdigit(), True)
        self.assertEqual(b.isdigit(), True)
        self.assertEqual(c.isdigit(), True)


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


import unittest
from mbed_greentea import mbed_greentea_cli

class GreenteaCliFunctionality(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_get_greentea_version(self):
        version = mbed_greentea_cli.get_greentea_version()

        self.assertIs(type(version), str)

        a, b, c = version.split('.')

        self.assertEqual(a.isdigit(), True)
        self.assertEqual(b.isdigit(), True)
        self.assertEqual(c.isdigit(), True)

    def get_hello_string(self):
        version = mbed_greentea_cli.get_greentea_version()
        hello_string = mbed_greentea_cli.get_hello_string()

        self.assertIs(type(version), str)
        self.assertIs(type(hello_string), str)
        self.assertIn(version, hello_string)


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

Add unit tests to mbed-greentea version printing API
Add unit tests to mbed-greentea version printing API

  
  import unittest
  from mbed_greentea import mbed_greentea_cli
  
  class GreenteaCliFunctionality(unittest.TestCase):
  
      def setUp(self):
          pass
  
      def tearDown(self):
          pass
  
-     def test_print_version(self):
+     def test_get_greentea_version(self):
-         version = mbed_greentea_cli.print_version(verbose=False)
+         version = mbed_greentea_cli.get_greentea_version()
+ 
+         self.assertIs(type(version), str)
+ 
          a, b, c = version.split('.')
+ 
          self.assertEqual(a.isdigit(), True)
          self.assertEqual(b.isdigit(), True)
          self.assertEqual(c.isdigit(), True)
+ 
+     def get_hello_string(self):
+         version = mbed_greentea_cli.get_greentea_version()
+         hello_string = mbed_greentea_cli.get_hello_string()
+ 
+         self.assertIs(type(version), str)
+         self.assertIs(type(hello_string), str)
+         self.assertIn(version, hello_string)
  
  
  if __name__ == '__main__':
      unittest.main()
  
Add unit tests to mbed-greentea version printing API
## Code Before:

import unittest
from mbed_greentea import mbed_greentea_cli

class GreenteaCliFunctionality(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_print_version(self):
        version = mbed_greentea_cli.print_version(verbose=False)
        a, b, c = version.split('.')
        self.assertEqual(a.isdigit(), True)
        self.assertEqual(b.isdigit(), True)
        self.assertEqual(c.isdigit(), True)


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

## Instruction:
Add unit tests to mbed-greentea version printing API
## Code After:

import unittest
from mbed_greentea import mbed_greentea_cli

class GreenteaCliFunctionality(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_get_greentea_version(self):
        version = mbed_greentea_cli.get_greentea_version()

        self.assertIs(type(version), str)

        a, b, c = version.split('.')

        self.assertEqual(a.isdigit(), True)
        self.assertEqual(b.isdigit(), True)
        self.assertEqual(c.isdigit(), True)

    def get_hello_string(self):
        version = mbed_greentea_cli.get_greentea_version()
        hello_string = mbed_greentea_cli.get_hello_string()

        self.assertIs(type(version), str)
        self.assertIs(type(hello_string), str)
        self.assertIn(version, hello_string)


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