Ejemplo n.º 1
0
 def test_datetime_domain_default(self):
     """ Test a DateTimeDomain with default start time. """
     actual = Domain.DateTimeDomain().draw(3)
     expected = [
         datetime(2000, 1, 1, 0, 0),
         datetime(2000, 1, 1, 0, 1),
         datetime(2000, 1, 1, 0, 2)
     ]
     self.assertItemsEqual(actual, expected)
Ejemplo n.º 2
0
 def test_datetime_domain_overflow(self):
     """ Confirm a DateTimeDomain does not overflow. """
     domain = Domain.DateTimeDomain(start=datetime(9999, 12, 31, 23, 58))
     actual = domain.draw(300)
     expected = [
         datetime(9999, 12, 31, 23, 58),
         datetime(9999, 12, 31, 23, 59)
     ]
     self.assertItemsEqual(actual, expected)
     self.assertEquals(domain.max_size, 2)
Ejemplo n.º 3
0
 def test_datetime_domain(self):
     """ Test a DateTimeDomain with provided start time. """
     actual = Domain.DateTimeDomain(
         start=datetime(1999, 12, 31, 23, 58)).draw(3)
     expected = [
         datetime(1999, 12, 31, 23, 58),
         datetime(1999, 12, 31, 23, 59),
         datetime(2000, 1, 1, 0, 0)
     ]
     self.assertItemsEqual(actual, expected)