Skip to content

Commit 4f0d4d9

Browse files
committed
Add test for no platform name case
1 parent 6c40a8c commit 4f0d4d9

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

pyorbital/tests/test_tlefile.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@
3838
line1_2 = "1 38771U 12049A 21137.30264622 .00000000 00000+0 -49996-5 0 00017"
3939
line2_2 = "2 38771 98.7162 197.7716 0002383 106.1049 122.6344 14.21477797449453"
4040

41-
NOAA19_LINES = """NOAA 19
42-
1 33591U 09005A 21355.91138073 .00000074 00000+0 65091-4 0 9998
41+
42+
NOAA19_2LINES = """1 33591U 09005A 21355.91138073 .00000074 00000+0 65091-4 0 9998
4343
2 33591 99.1688 21.1338 0013414 329.8936 30.1462 14.12516400663123
4444
"""
45+
NOAA19_3LINES = "NOAA 19\n" + NOAA19_2LINES
4546

4647
tle_xml = '\n'.join(
4748
('<?xml version="1.0" encoding="UTF-8"?>',
@@ -135,6 +136,32 @@ def test_from_file_with_hyphenated_platform_name(self):
135136
finally:
136137
remove(filename)
137138

139+
def test_from_file_with_hyphenated_platform_name(self):
140+
"""Test reading and parsing from a file with a slightly different name."""
141+
from tempfile import mkstemp
142+
from os import write, close, remove
143+
filehandle, filename = mkstemp()
144+
try:
145+
write(filehandle, NOAA19_3LINES.encode('utf-8'))
146+
close(filehandle)
147+
tle = Tle("NOAA-19", filename)
148+
assert tle.satnumber == "33591"
149+
finally:
150+
remove(filename)
151+
152+
def test_from_file_with_no_platform_name(self):
153+
"""Test reading and parsing from a file with a slightly different name."""
154+
from tempfile import mkstemp
155+
from os import write, close, remove
156+
filehandle, filename = mkstemp()
157+
try:
158+
write(filehandle, NOAA19_2LINES.encode('utf-8'))
159+
close(filehandle)
160+
tle = Tle("NOAA-19", filename)
161+
assert tle.satnumber == "33591"
162+
finally:
163+
remove(filename)
164+
138165
def test_from_mmam_xml(self):
139166
"""Test reading from an MMAM XML file."""
140167
from tempfile import TemporaryDirectory

0 commit comments

Comments
 (0)