-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move format iso 8601 to utils
- Loading branch information
1 parent
c33f3f0
commit 0863dca
Showing
4 changed files
with
59 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import datetime | ||
import unittest | ||
|
||
from parameterized import parameterized | ||
|
||
from censys.common.utils import format_iso8601, format_rfc3339 | ||
|
||
|
||
class UtilsTest(unittest.TestCase): | ||
@parameterized.expand( | ||
[ | ||
["2021-01-01", "2021-01-01"], | ||
[datetime.date(2021, 1, 1), "2021-01-01T00:00:00.000000Z"], | ||
[ | ||
datetime.datetime(2021, 1, 1, 12, 15, 20, 40), | ||
"2021-01-01T12:15:20.000040Z", | ||
], | ||
] | ||
) | ||
def test_format_rfc3339(self, since, actual): | ||
assert format_rfc3339(since) == actual | ||
|
||
@parameterized.expand( | ||
[ | ||
["2021-01-01", "2021-01-01"], | ||
[datetime.date(2021, 1, 1), "2021-01-01"], | ||
[datetime.datetime(2021, 1, 1, 12, 15, 20, 40), "2021-01-01"], | ||
] | ||
) | ||
def test_format_iso8601(self, since, actual): | ||
assert format_iso8601(since) == actual |