Skip to content

Commit

Permalink
Use the standard Python unittest library.
Browse files Browse the repository at this point in the history
Let's keep it simple and not use pytest.
  • Loading branch information
markdoliner committed Dec 27, 2023
1 parent 0317556 commit ebab3dd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ The Flickr API does not support downloading original video files. If this script

Running unit tests
==================
Run [`py.test`](http://pytest.org/).
Run `python -m unittest`


TODO
Expand Down
29 changes: 29 additions & 0 deletions test_flickrmirrorer.py
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")
29 changes: 0 additions & 29 deletions tests.py

This file was deleted.

2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
[flake8]
max-line-length = 120
[pytest]
python_files = tests.py

0 comments on commit ebab3dd

Please sign in to comment.