We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f89329a commit 3ed7cedCopy full SHA for 3ed7ced
adafruit_gps.py
@@ -130,7 +130,11 @@ def _read_deg_mins(data: List[str], index: int, neg: str) -> Tuple[int, float]:
130
# longitudes, which makes parsing tricky:
131
# for latitudes: ddmm,mmmm (0 - 7 decimal places, not zero padded)
132
# for longitudes: dddmm,mmmm (0 - 7 decimal places, not zero padded)
133
- int_part, _, minutes_decimal = data[index].partition(".")
+ if '.' in data[index]:
134
+ int_part, minutes_decimal = data[index].split(".")
135
+ else:
136
+ int_part, minutes_decimal = data[index], 0
137
+
138
# we need to parse from right to left, minutes can only have 2 digits
139
minutes_int = int_part[-2:]
140
# the rest must be degrees which are either 2 or 3 digits
tests/adafruit_gps_test.py
@@ -489,13 +489,13 @@ def test_GPS_update_from_GSV_both_parts_sats_are_removed():
489
@pytest.mark.parametrize(
490
("input_str", "exp", "neg"),
491
(
492
- (["3723.2475", "N"], (37, 23.2475), "S"),
493
- (["3723.2475", "S"], (-37, 23.2475), "s"),
494
- (["00123.1234", "E"], (1, 23.1234), "W"),
495
- (["00123", "E"], (1, 23), "W"),
496
- (["1234.5678", "E"], (12, 34.5678), "W"),
497
- (["3723.2475123", "N"], (37, 23.2475123), "S"),
498
- (["3723", "N"], (37, 23), "S"),
+ (["3723.2475", "n"], (37, 23.2475), "s"),
+ (["3723.2475", "s"], (-37, 23.2475), "s"),
+ (["00123.1234", "e"], (1, 23.1234), "w"),
+ (["00123", "e"], (1, 23), "w"),
+ (["1234.5678", "e"], (12, 34.5678), "w"),
+ (["3723.2475123", "n"], (37, 23.2475123), "s"),
+ (["3723", "n"], (37, 23), "s"),
499
),
500
)
501
def test_read_min_secs(input_str, exp, neg):
0 commit comments