Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1be39b1

Browse files
phobsonaustinorr
authored andcommitted
add a date formatter to hydra parser to suppress warnings
1 parent 6f099bb commit 1be39b1

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎cloudside/hydra.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def parse_file(filepath):
3535
"header": None,
3636
"parse_dates": ["Date"],
3737
"na_values": ["-"],
38+
"date_format": "%d-%b-%Y",
3839
}
3940

4041
with Path(filepath).open("r") as fr:

‎cloudside/tests/test_hydra.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from io import StringIO
33
from textwrap import dedent
44
import tempfile
5+
import warnings
56

67
import pandas
78

@@ -98,9 +99,11 @@ def expected_hydra():
9899

99100

100101
def test_parse_file(expected_hydra):
101-
filepath = Path(get_test_file("sample_hydra.txt"))
102-
result = hydra.parse_file(filepath)
103-
pdtest.assert_frame_equal(expected_hydra, result)
102+
with warnings.catch_warnings():
103+
warnings.simplefilter("error")
104+
filepath = Path(get_test_file("sample_hydra.txt"))
105+
result = hydra.parse_file(filepath)
106+
pdtest.assert_frame_equal(expected_hydra, result)
104107

105108

106109
@mock.patch("requests.get")

0 commit comments

Comments
 (0)