hacked comment parsing

This commit is contained in:
2019-01-29 11:46:29 +01:00
parent 8230fcc1c1
commit 6a4bb7c178
4 changed files with 6 additions and 4 deletions
+1
View File
@@ -1,3 +1,4 @@
build
__pycache__
.idea
.pytest_cache
+2
View File
@@ -8,6 +8,7 @@ import dateutil.parser
import pytz
import datetime
import time
import re
import logging
logger = logging.getLogger("logger")
@@ -78,6 +79,7 @@ def read_channels(filename):
channels = []
for line in lines:
line = re.sub(r'\w*#.*', "", line)
line = line.strip()
if line: # if not empty line
channels.append(line) # remove all leading and trailing spaces
+2 -1
View File
@@ -2,4 +2,5 @@ S10-CPCL-VM1MGC:LOAD
ONE
TWO
THREE
# Comment that need to be removed
THREE # one more comment at the end that need to be removed
+1 -3
View File
@@ -27,9 +27,7 @@ class TestDownloadData(TestCase):
def test_read_channels(self):
channels = cadump.read_channels("channels.txt")
logging.info(channels)
self.assertEqual(len(channels), 3)
self.assertEqual(len(channels), 4)
if __name__ == '__main__':