Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.forget_policy_tests.ForgetPolicyMatchTests Class Reference

List of all members.

Public Member Functions

def setUp
def match2
def test_hourly_matches
def test_daily_matches
def test_monthly_matches
def test_yearly_matches
def test_hourly_and_daily_match_together

Public Attributes

 fp

Detailed Description

Definition at line 57 of file forget_policy_tests.py.


Member Function Documentation

def obnamlib.forget_policy_tests.ForgetPolicyMatchTests.match2 (   self,
  spec,
  times 
)

Definition at line 62 of file forget_policy_tests.py.

00062 
00063     def match2(self, spec, times):
00064         rules = self.fp.parse(spec)
00065         return [dt for i, dt in self.fp.match(rules, list(enumerate(times)))]

Here is the caller graph for this function:

Definition at line 59 of file forget_policy_tests.py.

00059 
00060     def setUp(self):
00061         self.fp = obnamlib.ForgetPolicy()

Definition at line 74 of file forget_policy_tests.py.

00074 
00075     def test_daily_matches(self):
00076         d1h0 =  datetime.datetime(2000, 1, 1, 0, 0)
00077         d1h23 = datetime.datetime(2000, 1, 1, 23, 0)
00078         d2h0 =  datetime.datetime(2000, 1, 2, 0, 0)
00079         d2h23 = datetime.datetime(2000, 1, 2, 23, 0)
00080         self.assertEqual(self.match2('1d', [d1h0, d1h23, d2h0, d2h23]),
00081                          [d2h23])

Here is the call graph for this function:

Definition at line 101 of file forget_policy_tests.py.

00101 
00102     def test_hourly_and_daily_match_together(self):
00103         d1h0m0 = datetime.datetime(2000, 1, 1, 0, 0)
00104         d1h0m1 = datetime.datetime(2000, 1, 1, 0, 1)
00105         d2h0m0 = datetime.datetime(2000, 1, 2, 0, 0)
00106         d2h0m1 = datetime.datetime(2000, 1, 2, 0, 1)
00107         d3h0m0 = datetime.datetime(2000, 1, 3, 0, 0)
00108         d3h0m1 = datetime.datetime(2000, 1, 3, 0, 1)
00109         genlist = list(enumerate([d1h0m0, d1h0m1, d2h0m0, d2h0m1,
00110                                   d3h0m0, d3h0m1]))
00111         rules = self.fp.parse('1h,2d')
00112         self.assertEqual([dt for genid, dt in self.fp.match(rules, genlist)],
00113                          [d2h0m1, d3h0m1])
00114 

Definition at line 66 of file forget_policy_tests.py.

00066 
00067     def test_hourly_matches(self):
00068         h0m0 =  datetime.datetime(2000, 1, 1, 0, 0)
00069         h0m59 = datetime.datetime(2000, 1, 1, 0, 59)
00070         h1m0 =  datetime.datetime(2000, 1, 1, 1, 0)
00071         h1m59 = datetime.datetime(2000, 1, 1, 1, 59)
00072         self.assertEqual(self.match2('1h', [h0m0, h0m59, h1m0, h1m59]),
00073                          [h1m59])

Here is the call graph for this function:

Definition at line 85 of file forget_policy_tests.py.

00085 
00086     def test_monthly_matches(self):
00087         m1d1 =  datetime.datetime(2000, 1, 1, 0, 0)
00088         m1d28 = datetime.datetime(2000, 1, 28, 0, 0)
00089         m2d1 =  datetime.datetime(2000, 2, 1, 0, 0)
00090         m2d28 = datetime.datetime(2000, 2, 28, 0, 0)
00091         self.assertEqual(self.match2('1m', [m1d1, m1d28, m2d1, m2d28]),
00092                          [m2d28])

Here is the call graph for this function:

Definition at line 93 of file forget_policy_tests.py.

00093 
00094     def test_yearly_matches(self):
00095         y1m1 =  datetime.datetime(2000, 1, 1, 0, 0)
00096         y1m12 = datetime.datetime(2000, 12, 1, 0, 0)
00097         y2m1 =  datetime.datetime(2001, 1, 1, 0, 0)
00098         y2m12 = datetime.datetime(2001, 12, 1, 0, 0)
00099         self.assertEqual(self.match2('1y', [y1m1, y1m12, y2m1, y2m12]),
00100                          [y2m12])

Here is the call graph for this function:


Member Data Documentation

Definition at line 60 of file forget_policy_tests.py.


The documentation for this class was generated from the following file: