import os

from unittest import TestCase

from project_generator_definitions.definitions import ProGenTargets

class TestAllTargets(TestCase):

    """test all targets"""

    def setUp(self):
        self.progen_target = ProGenTargets()
        self.targets_list = self.progen_target.get_targets()

    def test_targets_validity(self):
        for target in self.targets_list:
            record = self.progen_target.get_target_record(target)
            assert record['target']['name'][0]
            assert record['target']['mcu'][0]

    def test_targets_mcu_validity(self):
        for target in self.targets_list:
            mcu = self.progen_target.get_mcu_record(target)
            assert mcu['mcu']
            assert mcu['mcu']['name']
            assert mcu['mcu']['core']


from unittest import TestCase

from project_generator_definitions.definitions import ProGenTargets

class TestAllTargets(TestCase):

    """test all targets"""

    def setUp(self):
        self.progen_target = ProGenTargets()
        self.targets_list = self.progen_target.get_targets()

    def test_targets_validity(self):
        # Cehck for required info for targets
        for target in self.targets_list:
            record = self.progen_target.get_target_record(target)
            assert record['target']['name'][0]
            assert record['target']['mcu'][0]

    def test_targets_mcu_validity(self):
        # Check for required info in mcu
        for target in self.targets_list:
            mcu = self.progen_target.get_mcu_record(target)
            assert mcu['mcu'][0]
            assert mcu['mcu']['name'][0]
            assert mcu['mcu']['core'][0]

Test - targets test fix mcu validity indexes
Test - targets test fix mcu validity indexes

- import os
  
  from unittest import TestCase
  
  from project_generator_definitions.definitions import ProGenTargets
  
  class TestAllTargets(TestCase):
  
      """test all targets"""
  
      def setUp(self):
          self.progen_target = ProGenTargets()
          self.targets_list = self.progen_target.get_targets()
  
      def test_targets_validity(self):
+         # Cehck for required info for targets
          for target in self.targets_list:
              record = self.progen_target.get_target_record(target)
              assert record['target']['name'][0]
              assert record['target']['mcu'][0]
  
      def test_targets_mcu_validity(self):
+         # Check for required info in mcu
          for target in self.targets_list:
              mcu = self.progen_target.get_mcu_record(target)
-             assert mcu['mcu']
+             assert mcu['mcu'][0]
-             assert mcu['mcu']['name']
+             assert mcu['mcu']['name'][0]
-             assert mcu['mcu']['core']
+             assert mcu['mcu']['core'][0]
  
Test - targets test fix mcu validity indexes
## Code Before:
import os

from unittest import TestCase

from project_generator_definitions.definitions import ProGenTargets

class TestAllTargets(TestCase):

    """test all targets"""

    def setUp(self):
        self.progen_target = ProGenTargets()
        self.targets_list = self.progen_target.get_targets()

    def test_targets_validity(self):
        for target in self.targets_list:
            record = self.progen_target.get_target_record(target)
            assert record['target']['name'][0]
            assert record['target']['mcu'][0]

    def test_targets_mcu_validity(self):
        for target in self.targets_list:
            mcu = self.progen_target.get_mcu_record(target)
            assert mcu['mcu']
            assert mcu['mcu']['name']
            assert mcu['mcu']['core']

## Instruction:
Test - targets test fix mcu validity indexes
## Code After:

from unittest import TestCase

from project_generator_definitions.definitions import ProGenTargets

class TestAllTargets(TestCase):

    """test all targets"""

    def setUp(self):
        self.progen_target = ProGenTargets()
        self.targets_list = self.progen_target.get_targets()

    def test_targets_validity(self):
        # Cehck for required info for targets
        for target in self.targets_list:
            record = self.progen_target.get_target_record(target)
            assert record['target']['name'][0]
            assert record['target']['mcu'][0]

    def test_targets_mcu_validity(self):
        # Check for required info in mcu
        for target in self.targets_list:
            mcu = self.progen_target.get_mcu_record(target)
            assert mcu['mcu'][0]
            assert mcu['mcu']['name'][0]
            assert mcu['mcu']['core'][0]
