コード例 #1
0
 def test_check_month_day_validity(self):
     for d in self.fail_date_month:
         print("FAIL month_day: {}".format(d))
         assert_raises(ValueError, SolrDaterange._check_month_day_validity, d)
     for d in self.pass_date_month:
         print("PASS month_day: {}".format(d))
         res = SolrDaterange._check_month_day_validity(d)
コード例 #2
0
 def test_validate(self):
     for t in self.pas_explicit_range:
         print("PASS validate: {}".format(t))
         gd = SolrDaterange.validate(t)
     for t in self.fail_explicit_range:
         print("FAIL validate: {}".format(t))
         assert_raises(ValueError, SolrDaterange.validate, t)
コード例 #3
0
 def test_validate(self):
     for t in self.pas_explicit_range:
         print("PASS validate: {}".format(t))
         gd = SolrDaterange.validate(t)
     for t in self.fail_explicit_range:
         print("FAIL validate: {}".format(t))
         assert_raises(ValueError, SolrDaterange.validate, t)
コード例 #4
0
 def test_check_month_day_validity(self):
     for d in self.fail_date_month:
         print("FAIL month_day: {}".format(d))
         assert_raises(ValueError, SolrDaterange._check_month_day_validity,
                       d)
     for d in self.pass_date_month:
         print("PASS month_day: {}".format(d))
         res = SolrDaterange._check_month_day_validity(d)
コード例 #5
0
    def test_check_date_element(self):
        for typ in self.fail:
            print("FAIL date_element typ: {}".format(typ))
            for e in self.fail[typ]:
                print("FAIL date_element: {}".format(e))
                assert_raises(ValueError,
                              SolrDaterange._check_date_element, typ, e)

        for y in self.pas:
            print("PASS date_element typ: {}".format(typ))
            for e in self.pas[typ]:
                print("PASS date_element: {}".format(e))
                assert (SolrDaterange._check_date_element(typ, e) == e)
コード例 #6
0
    def test_check_date_element(self):
        for typ in self.fail:
            print("FAIL date_element typ: {}".format(typ))
            for e in self.fail[typ]:
                print("FAIL date_element: {}".format(e))
                assert_raises(ValueError, SolrDaterange._check_date_element,
                              typ, e)

        for y in self.pas:
            print("PASS date_element typ: {}".format(typ))
            for e in self.pas[typ]:
                print("PASS date_element: {}".format(e))
                assert (SolrDaterange._check_date_element(typ, e) == e)
コード例 #7
0
 def test_check_implicit_range(self):
     for t in self.pas_implicit_range:
         print("PASS implicit_range: {}".format(t))
         gd = SolrDaterange._check_implicit_range(t)
         check = gd['year']
         try:
             check += '-' + gd['month']
             check += '-' + gd['day']
             check += 'T' + gd['hour']
             check += ':' + gd['minute']
             check += ':' + gd['second']
         except TypeError:
             pass
         assert(check == t)
     for t in self.fail_implicit_range:
         print("FAIL implicit: {}".format(t))
         assert_raises(ValueError, SolrDaterange._check_implicit_range, t)
コード例 #8
0
 def test_check_implicit_range(self):
     for t in self.pas_implicit_range:
         print("PASS implicit_range: {}".format(t))
         gd = SolrDaterange._check_implicit_range(t)
         check = gd['year']
         try:
             check += '-' + gd['month']
             check += '-' + gd['day']
             check += 'T' + gd['hour']
             check += ':' + gd['minute']
             check += ':' + gd['second']
         except TypeError:
             pass
         assert (check == t)
     for t in self.fail_implicit_range:
         print("FAIL implicit: {}".format(t))
         assert_raises(ValueError, SolrDaterange._check_implicit_range, t)