• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

petl-developers / petl / 14765567445

30 Apr 2025 10:21PM UTC coverage: 91.125% (+0.02%) from 91.11%
14765567445

Pull #680

github

web-flow
Merge 08c9304b1 into bb6957892
Pull Request #680: Add time-zone aware timestamp normalization transformer with tests

34 of 35 new or added lines in 2 files covered. (97.14%)

13419 of 14726 relevant lines covered (91.12%)

0.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.74
/petl/test/transform/test_normalize_timezone.py
1
import unittest
1✔
2
from petl.transform.normalize_timezone import normalize_timezone
1✔
3

4
class TestNormalizeTimezone(unittest.TestCase):
1✔
5

6
    def test_basic_conversion(self):
1✔
7
        input_data = [
1✔
8
            {'timestamp': '2023-12-01T10:00:00', 'timezone': 'America/New_York'},
9
            {'timestamp': '2023-12-01T15:00:00', 'timezone': 'Europe/London'}
10
        ]
11
        result = list(normalize_timezone(input_data))
1✔
12
        self.assertEqual(result[0]['timestamp_utc'], '2023-12-01T15:00:00+00:00')
1✔
13
        self.assertEqual(result[1]['timestamp_utc'], '2023-12-01T15:00:00+00:00')
1✔
14
        self.assertEqual(result[0]['timezone_original'], 'America/New_York')
1✔
15

16
    def test_invalid_timezone(self):
1✔
17
        input_data = [{'timestamp': '2023-12-01T10:00:00', 'timezone': 'Invalid/Zone'}]
1✔
18
        with self.assertRaises(ValueError):
1✔
19
            list(normalize_timezone(input_data))
1✔
20

21
    def test_missing_timestamp(self):
1✔
22
        input_data = [{'timezone': 'UTC'}]
1✔
23
        with self.assertRaises(ValueError):
1✔
24
            list(normalize_timezone(input_data))
1✔
25

26
if __name__ == '__main__':
1✔
NEW
27
    unittest.main()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc