core/domain/exp_domain_test.py

Summary

Maintainability
F
2 mos
Test Coverage

File exp_domain_test.py has 17203 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Severity: Major
Found in core/domain/exp_domain_test.py - About 1 mo to fix

    Function test_validation has 223 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def test_validation(self) -> None:
            """Test validation of explorations."""
            exploration = exp_domain.Exploration.create_default_exploration('eid')
            content_id_generator = translation_domain.ContentIdGenerator(
                exploration.next_content_id_index
    Severity: Major
    Found in core/domain/exp_domain_test.py - About 1 day to fix

      ExplorationDomainUnitTests has 54 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ExplorationDomainUnitTests(test_utils.GenericTestBase):
          """Test the exploration domain object."""
      
          def setUp(self) -> None:
              super().setUp()
      Severity: Major
      Found in core/domain/exp_domain_test.py - About 7 hrs to fix

        ExplorationSummaryTests has 42 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ExplorationSummaryTests(test_utils.GenericTestBase):
        
            def setUp(self) -> None:
                super().setUp()
                self.signup(self.OWNER_EMAIL, self.OWNER_USERNAME)
        Severity: Minor
        Found in core/domain/exp_domain_test.py - About 5 hrs to fix

          ExplorationChangesMergeabilityUnitTests has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ExplorationChangesMergeabilityUnitTests(
                  exp_services_test.ExplorationServicesUnitTests,
                  test_utils.EmailTestBase):
              """Test methods related to exploration changes mergeability."""
          
          
          Severity: Minor
          Found in core/domain/exp_domain_test.py - About 2 hrs to fix

            Function test_bypassable_state_with_card_is_checkpoint_true_is_invalid has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def test_bypassable_state_with_card_is_checkpoint_true_is_invalid(
                    self
                ) -> None:
                    # Note: In the graphs below, states with the * symbol are checkpoints.
            
            
            Severity: Major
            Found in core/domain/exp_domain_test.py - About 2 hrs to fix

              Function test_all_html_strings_are_collected has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def test_all_html_strings_are_collected(self) -> None:
              
                      exploration = exp_domain.Exploration.create_default_exploration(
                          'eid', title='title', category='category')
                      content_id_generator = translation_domain.ContentIdGenerator(
              Severity: Major
              Found in core/domain/exp_domain_test.py - About 2 hrs to fix

                Function test_correct_creation_of_version_diffs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def test_correct_creation_of_version_diffs(self) -> None:
                        # Rename a state.
                        self.exploration.rename_state('Home', 'Renamed state')
                        change_list = [exp_domain.ExplorationChange({
                            'cmd': 'rename_state',
                Severity: Major
                Found in core/domain/exp_domain_test.py - About 2 hrs to fix

                  Function test_get_trainable_states_dict has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def test_get_trainable_states_dict(self) -> None:
                          """Test the get_trainable_states_dict() method."""
                          exp_id = 'exp_id1'
                          test_exp_filepath = os.path.join(
                              feconf.TESTS_DATA_DIR, 'string_classifier_test.yaml')
                  Severity: Minor
                  Found in core/domain/exp_domain_test.py - About 1 hr to fix

                    Function test_drag_and_drop_interaction has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def test_drag_and_drop_interaction(self) -> None:
                            """Tests DragAndDrop interaction."""
                            self.state.recorded_voiceovers.add_content_id_for_voiceover(
                                'ca_choices_2')
                            content_id_generator = translation_domain.ContentIdGenerator()
                    Severity: Minor
                    Found in core/domain/exp_domain_test.py - About 1 hr to fix

                      Function test_tag_validation has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def test_tag_validation(self) -> None:
                              """Test validation of exploration tags."""
                              exploration = exp_domain.Exploration.create_default_exploration('eid')
                              content_id_generator = translation_domain.ContentIdGenerator(
                                  exploration.next_content_id_index
                      Severity: Minor
                      Found in core/domain/exp_domain_test.py - About 1 hr to fix

                        Function test_text_interaction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def test_text_interaction(self) -> None:
                                """Tests Text interaction."""
                                self.state.recorded_voiceovers.add_content_id_for_voiceover(
                                    'feedback_0')
                                self.state.recorded_voiceovers.add_content_id_for_voiceover(
                        Severity: Minor
                        Found in core/domain/exp_domain_test.py - About 1 hr to fix

                          Function test_fraction_interaction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def test_fraction_interaction(self) -> None:
                                  """Tests Fraction interaction."""
                                  state = self.new_exploration.states['Introduction']
                                  content_id_generator = translation_domain.ContentIdGenerator()
                                  self.set_interaction_for_state(
                          Severity: Minor
                          Found in core/domain/exp_domain_test.py - About 1 hr to fix

                            Function test_item_selection_choice_interaction has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def test_item_selection_choice_interaction(self) -> None:
                                    """Tests ItemSelection interaction."""
                                    content_id_generator = translation_domain.ContentIdGenerator()
                                    self.set_interaction_for_state(
                                        self.state, 'ItemSelectionInput', content_id_generator)
                            Severity: Minor
                            Found in core/domain/exp_domain_test.py - About 1 hr to fix

                              Function _require_metadata_properties_to_be_synced has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def _require_metadata_properties_to_be_synced(self) -> None:
                                      """Raises error if there is a new metadata property in the Exploration
                                      object and it is not added in the ExplorationMetadata domain object.
                              
                                      Raises:
                              Severity: Minor
                              Found in core/domain/exp_domain_test.py - About 35 mins to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              There are no issues that match your filters.

                              Category
                              Status