Exemple #1
0
 def test_tzto_parts_15_51_12_933_458_150(self):
     """Test TZTimeOnly with h, m, s, ms, and us components,
      partial hour offset."""
     msg = FixMessage()
     msg.append_tz_time_only_parts(1, 15, 51, 12, 933, 458, offset=150)
     self.assertEqual(fix_str("15:51:12.933458+02:30"), msg.get(1))
     return
Exemple #2
0
 def test_tzto_parts_15_51_240(self):
     """Test TZTimeOnly with hour and minute components,
      full hour offset"""
     msg = FixMessage()
     msg.append_tz_time_only_parts(1, 15, 51, offset=-240)
     self.assertEqual(fix_str("15:51-04"), msg.get(1))
     return
Exemple #3
0
 def test_tzto_parts_15_51_12_270(self):
     """Test TZTimeOnly with hour, minute and second components,
      partial hour offset."""
     msg = FixMessage()
     msg.append_tz_time_only_parts(1, 15, 51, 12, offset=-270)
     self.assertEqual(fix_str("15:51:12-04:30"), msg.get(1))
     return
Exemple #4
0
 def test_tzto_parts_bad_us(self):
     """Test TZTimeOnly with out-of-range microseconds components"""
     msg = FixMessage()
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, 15, 51, 12, 0, 1000)
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, 15, 51, 12, 0, -1)
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, 0, 0, 0, 0, "e")
     return
Exemple #5
0
 def test_tzto_parts_bad_minute(self):
     """Test TZTimeOnly with out-of-range minute components"""
     msg = FixMessage()
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, 15, 60, 0)
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, 15, -1, 0)
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, 0, "b", 0)
     return
Exemple #6
0
 def test_tzto_parts_bad_hour(self):
     """Test TZTimeOnly with out-of-range hour components"""
     msg = FixMessage()
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, 24, 0, 0)
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, -1, 0, 0)
     with self.assertRaises(ValueError):
         msg.append_tz_time_only_parts(1, "a", 0, 0)
     return
Exemple #7
0
    def test_tzto_parts_bad_ms(self):
        """Test TZTimeOnly with out-of-range milliseconds components"""
        if VERSION == 26:
            return

        msg = FixMessage()
        with self.assertRaises(ValueError):
            msg.append_tz_time_only_parts(1, 15, 51, 12, 1000)
        with self.assertRaises(ValueError):
            msg.append_tz_time_only_parts(1, 15, 51, 12, -1)
        with self.assertRaises(ValueError):
            msg.append_tz_time_only_parts(1, 0, 0, 0, "d")
Exemple #8
0
 def test_tzto_parts_15_51_12_933_270(self):
     """Test TZTimeOnly with h, m, s and ms components,
      partial hour offset."""
     msg = FixMessage()
     msg.append_tz_time_only_parts(1, 15, 51, 12, 933, offset=-270)
     self.assertEqual(fix_str("15:51:12.933-04:30"), msg.get(1))