def test_disjunction(self): # ARRANGE # model = [ '1st\n', '2nd\n', '3rd\n', ] arguments = tr.filter_lm__within_parens( arg_rend.disjunction([ lm_arg.Contents(sm_args.Equals(FileOrString.of_string('2nd'))), lm_arg.Contents(sm_args.Equals(FileOrString.of_string('3rd'))), ])) # ACT & ASSET # tr.check( self, Case(model, arguments, [], [model[1], model[2]], len(model)), )
def test_non_complex(self): # ARRANGE # model = [ '1st\n', '2nd\n', '3rd\n', ] arguments = tr.filter_lm( lm_arg.Contents(sm_args.Equals(FileOrString.of_string('2nd')))) # ACT & ASSET # tr.check( self, Case(model, arguments, [], [model[1]], len(model)), )
def test_negation(self): # ARRANGE # model = [ '1st\n', '2nd\n', '3rd\n', ] arguments = tr.filter_lm( arg_rend.negation( lm_arg.Contents(sm_args.Equals( FileOrString.of_string('2nd'))))) # ACT & ASSET # tr.check( self, Case(model, arguments, [], [model[0], model[2]], len(model)), )
def test_negation_of_disjunction(self): # ARRANGE # model = [ '1st\n', '2nd\n', '3rd\n', ] neg_open_lower_limit = IntSymbol('lower_limit') arguments = tr.filter_lm( arg_rend.negation( arg_rend.within_paren( arg_rend.disjunction([ lm_arg.Contents( sm_args.Equals(FileOrString.of_string('2nd'))), lm_arg.LineNum2( im_args.comparison( comparators.GT, SymbolReferenceWReferenceSyntax( neg_open_lower_limit.name))), ])))) model_and_args = ModelAndArguments(model, arguments) # ACT & ASSET # tr.check_cases__named( self, [ model_and_args.case__n( [neg_open_lower_limit.value(1)], max_num_lines_from_iter=3, expected_output_lines=[1], ), model_and_args.case__n( [neg_open_lower_limit.value(2)], max_num_lines_from_iter=3, expected_output_lines=[1], ), model_and_args.case__n( [neg_open_lower_limit.value(3)], max_num_lines_from_iter=3, expected_output_lines=[1, 3], ), ], )
def runTest(self): self._check_cases([ NArrEx('empty', sm_args.Empty(), asrt_interval.matches_unlimited()), NArrEx( 'conjunction', arg_rend.within_paren( arg_rend.conjunction([ sm_args.Empty(), sm_args.Equals(FileOrString.of_string('expected')), ])), asrt_interval.matches_unlimited()), NArrEx('negation', arg_rend.within_paren(arg_rend.negation(sm_args.Empty())), asrt_interval.matches_unlimited()), NArrEx( 'constant False' '(currently not able to derive interval from contents - ' 'would like this to become the empty interval)', arg_rend.constant(False), asrt_interval.matches_unlimited()), NArrEx('constant False', arg_rend.constant(True), asrt_interval.matches_unlimited()), ])
def test_disjunction(self): # ARRANGE # model = [ '1st\n', '2nd\n', '3rd\n', ] num_model_elements = len(model) upper_limit = IntSymbol('upper_limit') arguments = tr.filter_lm__within_parens( arg_rend.disjunction([ lm_arg.Contents(sm_args.Equals(FileOrString.of_string('2nd'))), lm_arg.LineNum2( im_args.comparison( comparators.LTE, SymbolReferenceWReferenceSyntax(upper_limit.name))), ])) model_and_args = ModelAndArguments(model, arguments) # ACT & ASSET # tr.check_cases__named( self, [ model_and_args.case__n( [upper_limit.value(-3)], max_num_lines_from_iter=num_model_elements, expected_output_lines=[2], ), model_and_args.case__n( [upper_limit.value(2)], max_num_lines_from_iter=num_model_elements, expected_output_lines=_from_to(1, 2), ), model_and_args.case__n( [upper_limit.value(10)], max_num_lines_from_iter=num_model_elements, expected_output_lines=_from_to(1, 3), ), ], )