示例#1
0
 def runTest(self):
     self._check_cases([
         NArrEx('constant False', arg_rend.constant(False),
                asrt_interval.matches_empty()),
         NArrEx('constant True', arg_rend.constant(True),
                asrt_interval.matches_unlimited()),
     ])
示例#2
0
 def runTest(self):
     _check_single(
         self,
         sut.Finite(0, 13),
         matches_finite(0, 13),
         matches_unlimited(),
     )
示例#3
0
 def runTest(self):
     _check_single(
         self,
         sut.point(7),
         matches_point(7),
         matches_unlimited(),
     )
示例#4
0
 def runTest(self):
     _check_single(
         self,
         sut.Unlimited(),
         matches_unlimited(),
         matches_empty(),
     )
示例#5
0
 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()),
     ])
示例#6
0
 def runTest(self):
     self._check_cases([
         NArrEx('equals (within line-num-range)',
                im_args.comparison2(comparators.EQ, 2),
                asrt_interval.matches_point(2)),
         NArrEx('equals (outside line-num-range)',
                im_args.comparison2(comparators.EQ, -2),
                asrt_interval.matches_empty()),
         NArrEx('greater-than (within line-num-range)',
                im_args.comparison2(comparators.GT, 7),
                asrt_interval.matches_lower_limit(7 + 1)),
         NArrEx('greater-than (outside line-num-range)',
                im_args.comparison2(comparators.GTE, -7),
                asrt_interval.matches_unlimited()),
         NArrEx('greater-than-eq (FIRST-LINE-NUMBER)',
                im_args.comparison2(comparators.GTE, FIRST_LINE_NUMBER),
                asrt_interval.matches_unlimited()),
         NArrEx(
             'greater-than && less-than (within line-num-range)',
             arg_rend.within_paren(
                 arg_rend.conjunction([
                     im_args.comparison2(comparators.GT, 7),
                     im_args.comparison2(comparators.LTE, 12),
                 ])), asrt_interval.matches_finite(7 + 1, 12)),
         NArrEx(
             'greater-than && less-than (outside line-num-range)',
             arg_rend.within_paren(
                 arg_rend.conjunction([
                     im_args.comparison2(comparators.GT, -7),
                     im_args.comparison2(comparators.LTE, 12),
                 ])), asrt_interval.matches_upper_limit(12)),
         NArrEx('constant False', arg_rend.constant(False),
                asrt_interval.matches_empty()),
         NArrEx('constant False', arg_rend.constant(True),
                asrt_interval.matches_unlimited()),
     ])
示例#7
0
 def runTest(self):
     self._check_cases([
         NArrEx(
             '! >= (within line-num-range)',
             arg_rend.negation(
                 args.LineNum2(im_args.comparison2(comparators.GTE, 4))),
             asrt_interval.matches_upper_limit(4 - 1)),
         NArrEx(
             '! >= (outside line-num-range)',
             arg_rend.negation(
                 args.LineNum2(
                     im_args.comparison2(comparators.LTE,
                                         FIRST_LINE_NUMBER - 1))),
             asrt_interval.matches_unlimited()),
         NArrEx('negation contents',
                arg_rend.negation(args.Contents(sm_args.Empty())),
                asrt_interval.matches_unlimited()),
         NArrEx('negation constant False',
                arg_rend.negation(arg_rend.constant(False)),
                asrt_interval.matches_unlimited()),
         NArrEx('negation constant True',
                arg_rend.negation(arg_rend.constant(True)),
                asrt_interval.matches_empty()),
         NArrEx(
             '> && <= (within line-num-range)',
             arg_rend.within_paren(
                 arg_rend.conjunction([
                     args.LineNum2(im_args.comparison2(comparators.GT, 7)),
                     args.LineNum2(im_args.comparison2(comparators.LTE,
                                                       12)),
                 ])), asrt_interval.matches_finite(7 + 1, 12)),
         NArrEx(
             '> && contents (within line-num-range)',
             arg_rend.within_paren(
                 arg_rend.conjunction([
                     args.LineNum2(im_args.comparison2(comparators.GT, 7)),
                     args.Contents(sm_args.Empty()),
                 ])), asrt_interval.matches_lower_limit(7 + 1)),
         NArrEx(
             'contents && contents',
             arg_rend.within_paren(
                 arg_rend.conjunction([
                     args.Contents(sm_args.Empty()),
                     args.Contents(sm_args.Empty()),
                 ])), asrt_interval.matches_unlimited()),
         NArrEx(
             '> && <= (partly outside line-num-range)',
             arg_rend.within_paren(
                 arg_rend.conjunction([
                     args.LineNum2(im_args.comparison2(comparators.GT, -7)),
                     args.LineNum2(im_args.comparison2(comparators.LTE,
                                                       12)),
                 ])), asrt_interval.matches_upper_limit(12)),
         NArrEx(
             '> && <= (completely outside line-num-range)',
             arg_rend.within_paren(
                 arg_rend.conjunction([
                     args.LineNum2(im_args.comparison2(comparators.GT, -7)),
                     args.LineNum2(im_args.comparison2(comparators.LTE,
                                                       -2)),
                 ])), asrt_interval.matches_empty()),
         NArrEx(
             '> && <= && <= (outside line-num-range)',
             arg_rend.within_paren(
                 arg_rend.conjunction([
                     args.LineNum2(im_args.comparison2(comparators.GT, -7)),
                     args.LineNum2(im_args.comparison2(comparators.LTE,
                                                       12)),
                     args.LineNum2(im_args.comparison2(comparators.LTE,
                                                       15)),
                 ])), asrt_interval.matches_upper_limit(12)),
         NArrEx(
             '== || <= (within line-num-range)',
             arg_rend.within_paren(
                 arg_rend.disjunction([
                     args.LineNum2(im_args.comparison2(comparators.EQ, 17)),
                     args.LineNum2(im_args.comparison2(comparators.LTE,
                                                       10)),
                 ])), asrt_interval.matches_upper_limit(17)),
         NArrEx(
             '== || contents (within line-num-range)',
             arg_rend.within_paren(
                 arg_rend.disjunction([
                     args.LineNum2(im_args.comparison2(comparators.EQ, 17)),
                     args.Contents(sm_args.Empty()),
                 ])), asrt_interval.matches_unlimited()),
         NArrEx(
             'contents || contents',
             arg_rend.within_paren(
                 arg_rend.disjunction([
                     args.Contents(sm_args.Empty()),
                     args.Contents(sm_args.Empty()),
                 ])), asrt_interval.matches_unlimited()),
         NArrEx(
             '> || == (outside line-num-range)',
             arg_rend.within_paren(
                 arg_rend.disjunction([
                     args.LineNum2(im_args.comparison2(comparators.GT, 5)),
                     args.LineNum2(im_args.comparison2(comparators.EQ,
                                                       -12)),
                 ])), asrt_interval.matches_lower_limit(5 + 1)),
         NArrEx(
             '< || <= (completely outside line-num-range)',
             arg_rend.within_paren(
                 arg_rend.disjunction([
                     args.LineNum2(im_args.comparison2(comparators.LT, -5)),
                     args.LineNum2(im_args.comparison2(comparators.LTE,
                                                       -3)),
                 ])), asrt_interval.matches_empty()),
         NArrEx(
             '<= || > || == (outside line-num-range)',
             arg_rend.within_paren(
                 arg_rend.disjunction([
                     args.LineNum2(im_args.comparison2(comparators.LTE, 0)),
                     args.LineNum2(im_args.comparison2(comparators.GT, 5)),
                     args.LineNum2(im_args.comparison2(comparators.EQ, 3)),
                 ])), asrt_interval.matches_lower_limit(3)),
         NArrEx(
             '<= || contents || == (within line-num-range)',
             arg_rend.within_paren(
                 arg_rend.disjunction([
                     args.LineNum2(im_args.comparison2(comparators.LTE,
                                                       12)),
                     args.Contents(sm_args.Empty()),
                     args.LineNum2(im_args.comparison2(comparators.EQ, 15)),
                 ])), asrt_interval.matches_unlimited()),
     ])