Ejemplo n.º 1
0
 def test_equals(self):
     # ARRANGE #
     section_name = 'expected_section'
     instruction_name = 'expected_instruction'
     expected = sut.TestSuiteSectionInstructionCrossReference(
         section_name, instruction_name)
     actual = sut.TestSuiteSectionInstructionCrossReference(
         section_name, instruction_name)
     # ASSERT #
     self.assertEqual(expected, actual)
Ejemplo n.º 2
0
 def test_not_equals_of_same_type(self):
     # ARRANGE #
     expected_section = 'expected_section'
     expected_instruction = 'expected_instruction'
     expected = sut.TestSuiteSectionInstructionCrossReference(
         expected_section, expected_instruction)
     actuals = [
         sut.TestSuiteSectionInstructionCrossReference(
             'actual_section', expected_instruction),
         sut.TestSuiteSectionInstructionCrossReference(
             expected_section, 'actual_instruction'),
     ]
     for actual in actuals:
         with self.subTest(actual=actual):
             self.assertNotEqual(expected, actual)
Ejemplo n.º 3
0
 def test_visit_TestSuiteSectionInstructionCrossReference(self):
     # ARRANGE #
     x = sut.TestSuiteSectionInstructionCrossReference(
         'section name', 'instruction name')
     visitor = VisitorThatRegistersVisitedClassesAndReturnsTheArgument()
     # ACT #
     returned = visitor.visit(x)
     # ASSERT #
     self.assertEqual([sut.TestSuiteSectionInstructionCrossReference],
                      visitor.visited_classes)
     self.assertIs(
         x, returned,
         'The object itself is expected to be returned by the visitor')
Ejemplo n.º 4
0
 def test_not_equals_for_every_type(self):
     expected = sut.TestSuiteSectionInstructionCrossReference(
         'expected_section', 'expected_instruction')
     for actual in ACTUAL_CROSS_REF_ID_OF_EVERY_TYPE:
         with self.subTest(actual=actual):
             self.assertNotEqual(expected, actual)
Ejemplo n.º 5
0
        actual = sut.TestSuiteSectionInstructionCrossReference(
            section_name, instruction_name)
        # ASSERT #
        self.assertEqual(expected, actual)


ACTUAL_CROSS_REF_ID_OF_EVERY_TYPE = [
    sut.CustomCrossReferenceId('actual'),
    sut.EntityCrossReferenceId(
        entity_type_names('actual_entity_identifier',
                          'actual presentation name'), 'actual'),
    sut.TestCasePhaseCrossReference('actual'),
    sut.TestCasePhaseInstructionCrossReference('actual_phase',
                                               'actual_instruction'),
    sut.TestSuiteSectionCrossReference('actual'),
    sut.TestSuiteSectionInstructionCrossReference('actual_section',
                                                  'actual_instruction'),
]


class CrossReferenceIdVisitorTest(unittest.TestCase):
    def test_visit_Url(self):
        # ARRANGE #
        x = sut.UrlCrossReferenceTarget('the url')
        visitor = VisitorThatRegistersVisitedClassesAndReturnsTheArgument()
        # ACT #
        returned = visitor.visit(x)
        # ASSERT #
        self.assertEqual([sut.UrlCrossReferenceTarget],
                         visitor.visited_classes)
        self.assertIs(
            x, returned,