~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: James Henstridge
  • Date: 2007-01-04 10:45:55 UTC
  • mto: (2221.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2222.
  • Revision ID: james@jamesh.id.au-20070104104555-6ffbz0z2ywkfspk1
narrow the range that the local_time_offset() test uses

Show diffs side-by-side

added added

removed removed

Lines of Context:
684
684
        """Test that local_time_offset() returns a sane value."""
685
685
        offset = osutils.local_time_offset()
686
686
        self.assertTrue(isinstance(offset, int))
687
 
        # Test that the offset is no more than a day in either direction.
688
 
        # Given that time zone handling is platform dependent, we can't
689
 
        # do more than ensure the value is in the right ball park.
690
 
        self.assertTrue(-86400 < offset < 86400)
 
687
        # Test that the offset is no more than a eighteen hours in
 
688
        # either direction.
 
689
        # Time zone handling is system specific, so it is difficult to
 
690
        # do more specific tests, but a value outside of this range is
 
691
        # probably wrong.
 
692
        eighteen_hours = 18 * 3600
 
693
        self.assertTrue(-eighteen_hours < offset < eighteen_hours)
691
694
 
692
695
    def test_local_time_offset_with_timestamp(self):
693
696
        """Test that local_time_offset() works with a timestamp."""
694
697
        offset = osutils.local_time_offset(1000000000.1234567)
695
698
        self.assertTrue(isinstance(offset, int))
696
 
        self.assertTrue(-86400 < offset < 86400)
 
699
        eighteen_hours = 18 * 3600
 
700
        self.assertTrue(-eighteen_hours < offset < eighteen_hours)