Esempio n. 1
0
 def test_differs__both_are_relative_but_with_different_relativity(self):
     # ARRANGE #
     expected = specific_relative_relativity(RelOptionType.REL_ACT)
     actual = specific_relative_relativity(RelOptionType.REL_HDS_CASE)
     assertion = sut.equals_path_relativity(expected)
     # ACT & ASSERT #
     assert_that_assertion_fails(assertion, actual)
 def runTest(self):
     test_case = [
         (SPECIFIC_ABSOLUTE_RELATIVITY,
          sut.PathRelativityVariants(set(), False),
          False,
          'ACTUAL=absolute, ACCEPTED does NOT accept absolute'
          ),
         (SPECIFIC_ABSOLUTE_RELATIVITY,
          sut.PathRelativityVariants({RelOptionType.REL_ACT}, False),
          False,
          'ACTUAL=absolute, ACCEPTED does NOT accept absolute (but relative is)'
          ),
         (SPECIFIC_ABSOLUTE_RELATIVITY,
          sut.PathRelativityVariants(set(), True),
          True,
          'ACTUAL=absolute, ACCEPTED does accept absolute'
          ),
         (specific_relative_relativity(RelOptionType.REL_ACT),
          sut.PathRelativityVariants(set(), False),
          False,
          'ACTUAL=relative, ACCEPTED does accept relative (and not absolute)'
          ),
         (specific_relative_relativity(RelOptionType.REL_ACT),
          sut.PathRelativityVariants(set(), True),
          False,
          'ACTUAL=relative, ACCEPTED does accept relative (but absolute)'
          ),
         (specific_relative_relativity(RelOptionType.REL_ACT),
          sut.PathRelativityVariants({RelOptionType.REL_CWD,
                                      RelOptionType.REL_HDS_CASE},
                                     True),
          False,
          'ACTUAL=relative, ACCEPTED actual NOT IN set of accepted (but absolute)'
          ),
         (specific_relative_relativity(RelOptionType.REL_HDS_CASE),
          sut.PathRelativityVariants({RelOptionType.REL_CWD,
                                      RelOptionType.REL_HDS_CASE},
                                     True),
          True,
          'ACTUAL=relative, ACCEPTED actual IN set of accepted (but absolute)'
          ),
     ]
     for specific, accepted, expected, description in test_case:
         with self.subTest(msg=description):
             actual = sut.is_satisfied_by(specific, accepted)
             if expected:
                 self.assertTrue(actual)
             else:
                 self.assertFalse(actual)
Esempio n. 3
0
 def test_differs__because_on_is_absolute(self):
     # ARRANGE #
     expected = SPECIFIC_ABSOLUTE_RELATIVITY
     actual = specific_relative_relativity(RelOptionType.REL_ACT)
     assertion = sut.equals_path_relativity(expected)
     # ACT & ASSERT #
     assert_that_assertion_fails(assertion, actual)
Esempio n. 4
0
 def test_relative(self):
     for rel_option in RelOptionType:
         # ARRANGE #
         relativity = specific_relative_relativity(
             RelOptionType.REL_HDS_CASE)
         with self.subTest(msg='RelOptionType=' + str(rel_option)):
             assertion = sut.equals_path_relativity(relativity)
             # ACT & ASSERT #
             assertion.apply_with_message(self, relativity, 'Equals')
Esempio n. 5
0
 def relativity(self) -> SpecificPathRelativity:
     rel_option_type = self._relativity()
     return specific_relative_relativity(rel_option_type)