-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the standard Python unittest library.
Let's keep it simple and not use pytest.
- Loading branch information
1 parent
0317556
commit ebab3dd
Showing
4 changed files
with
30 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import unittest | ||
|
||
from flickrmirrorer import get_photo_datetime | ||
|
||
class Tests(unittest.TestCase): | ||
def test_unparseable_title_timestamp(self): | ||
timestamp = get_photo_datetime({ | ||
'datetakenunknown': '1', | ||
'datetaken': '2014-10-01 13:45:37', | ||
'title': 'flaskpost' | ||
}) | ||
|
||
# Fall back on datetaken if we can't parse the date from the title | ||
self.assertEqual(timestamp.isoformat(), "2014-10-01T13:45:37") | ||
|
||
def test_plain_title_timestamp(self): | ||
timestamp = get_photo_datetime({ | ||
'datetakenunknown': '1', | ||
'datetaken': '2014-10-01 13:45:37', | ||
'title': '20151130_135610' | ||
}) | ||
self.assertEqual(timestamp.isoformat(), "2015-11-30T13:56:10") | ||
|
||
def test_known_timestamp(self): | ||
timestamp = get_photo_datetime({ | ||
'datetakenunknown': '0', | ||
'datetaken': '2015-11-02 12:35:07' | ||
}) | ||
self.assertEqual(timestamp.isoformat(), "2015-11-02T12:35:07") |
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
[pytest] | ||
python_files = tests.py |