fix: replace manual nanosecond calculations with time.Hour in frequency tests#733
fix: replace manual nanosecond calculations with time.Hour in frequency tests#733krishnavermaKV wants to merge 2 commits intoOneBusAway:mainfrom
Conversation
|
@aaronbrethorst can you please review the pr |
|
@CLAassistant can you run workflows |
aaronbrethorst
left a comment
There was a problem hiding this comment.
Hey Krishna, this is a nice cleanup — replacing 3600 * 1e9 with time.Hour makes these tests much more readable at a glance. The change is mechanically correct and all frequency tests pass.
Important Issues (1 found)
1. go fmt not run — formatting errors in the file
The project requires running go fmt ./... before committing (see CLAUDE.md). There are two formatting issues:
gtfsdb/bulk_insert_frequency_test.go:7 — The "time" import uses spaces instead of a tab:
// Current (spaces):
"time"
// Should be (tab):
"time"gtfsdb/bulk_insert_frequency_test.go:107 — Comment alignment has an extra space after the change shortened the line:
// Current:
HeadwaySecs: 600, // 10 minutes
// After go fmt:
HeadwaySecs: 600, // 10 minutesRunning go fmt ./gtfsdb/bulk_insert_frequency_test.go will fix both automatically.
Strengths
- Clean, focused change — one file, one concern
int64(6 * time.Hour)is immediately readable vsint64(6 * 3600 * 1e9)- The loop case on line 131 (
time.Duration(i) * time.Hour) correctly handles the type conversion
Recommended Action
- Run
go fmt ./...and commit the result - Please go read this: https://opentransitsoftwarefoundation.org/2025/12/our-policy-on-ai-generated-contributions/
|
Thanks for the review @aaronbrethorst |
🚀 Overview
This PR improves time handling in frequency-related tests by replacing manual nanosecond calculations (e.g.,
* 1e9) with Go’stimepackage.🔧 Changes
* 1e9withtime.Hour/time.Second🎯 Why This Matters
time.Duration)🧪 Testing
🔗 Related Issue
Fixes #727