adding first set of tests
This commit is contained in:
parent
de269ef39e
commit
a57fac3b11
4 changed files with 112 additions and 0 deletions
54
tests.py
Normal file
54
tests.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
import unittest
|
||||
import pandoc
|
||||
import exiftool
|
||||
import nasg
|
||||
import os
|
||||
import json
|
||||
|
||||
class TestNASG(unittest.TestCase):
|
||||
def test_url2slug(self):
|
||||
i = 'http://boffosocko.com/2017/10/28/content-bloat-privacy-archives-peter-molnar/'
|
||||
o = 'boffosockocom20171028content-bloat-privacy-archives-peter-molnar'
|
||||
self.assertEqual(nasg.url2slug(i), o)
|
||||
|
||||
class TestSingular(unittest.TestCase):
|
||||
singular = nasg.Singular('tests/index.md')
|
||||
|
||||
# TODO: WTF?
|
||||
#def test_category(self):
|
||||
#print(self.singular.category)
|
||||
#self.assertEqual(self.singular.category, 'tests')
|
||||
|
||||
#def test_files(self):
|
||||
|
||||
#self.assertEqual(
|
||||
#self.singular.files,
|
||||
#['/home/pemolnar/Projects/petermolnar.net/nasg/tests/tests.jpg']
|
||||
|
||||
def test_is_photo(self):
|
||||
self.assertTrue(self.singular.is_photo)
|
||||
|
||||
def test_is_front(self):
|
||||
self.assertFalse(self.singular.is_front)
|
||||
|
||||
def test_singular_tags(self):
|
||||
self.assertEqual(
|
||||
self.singular.tags,
|
||||
['Llyn Idwal', 'winter', 'spring', 'cloudy', 'Snowdonia', 'mountain', 'clouds', 'lake', 'mountains', 'snow', 'Wales', 'water']
|
||||
)
|
||||
|
||||
class TestExiftool(unittest.TestCase):
|
||||
def test_exiftool(self):
|
||||
with open('tests/.tests.jpg.json', 'rt') as expected:
|
||||
o = json.loads(expected.read())
|
||||
self.assertEqual(exiftool.Exif('tests/tests.jpg'), o)
|
||||
|
||||
class TestPandoc(unittest.TestCase):
|
||||
def test_pandoc(self):
|
||||
i = '_this_ is a **test** string for [pandoc](https://pandoc.org)'
|
||||
o = '<p><em>this</em> is a <strong>test</strong> string for <a href="https://pandoc.org">pandoc</a></p>'
|
||||
self.assertEqual(pandoc.Pandoc(i), o)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
29
tests/.tests.jpg.json
Normal file
29
tests/.tests.jpg.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"Aperture": 11.0,
|
||||
"Artist": "Peter Molnar",
|
||||
"Copyright": "Copyright 2016 Peter Molnar <hello@petermolnar.eu> (https://petermolnar.net), CC BY-NC-ND 4.0",
|
||||
"CreateDate": "2016-05-01T00:08:24+00:00",
|
||||
"DateTimeOriginal": "2016-05-01T00:08:24+00:00",
|
||||
"Description": "One can always wish for the perfect weather, yet most of the times, it remains a wish. Not this time.\n\nThere is a National Trust recommendation to visit Llyn Idwal, which Nora[^1] spotted, and they were right about the place: it's magnificent. We really weren't expecting snow on the mountains in May, but that, combined with the clouds and the late afternoon sunshine was just perfect.\n\nI cropped the image, but apart from that, it really looked like this. No edits, no nothing.\n\n[^1]: https://norahamucska.eu",
|
||||
"ExposureTime": "1/320",
|
||||
"FNumber": 11.0,
|
||||
"FOV": "67.4 deg",
|
||||
"FileName": "llyn-idwal.jpg",
|
||||
"FileSize": 29123,
|
||||
"FileType": "JPEG",
|
||||
"FocalLength": "18.0 mm",
|
||||
"FocalLengthIn35mmFormat": "27 mm",
|
||||
"GPSLatitude": 53.115584,
|
||||
"GPSLongitude": -4.030248,
|
||||
"Headline": "Llyn Idwal",
|
||||
"HierarchicalSubject": "Llyn Idwal",
|
||||
"ISO": 160,
|
||||
"ImageHeight": 139,
|
||||
"ImageWidth": 256,
|
||||
"LensID": "HD PENTAX-DA 16-85mm F3.5-5.6 ED DC WR",
|
||||
"MIMEType": "image/jpeg",
|
||||
"Model": "PENTAX K-5 II s",
|
||||
"ModifyDate": "2016-05-01T00:08:24+00:00",
|
||||
"ReleaseDate": "2016-07-23T09:00:23+00:00",
|
||||
"SourceFile": "tests/llyn-idwal.jpg"
|
||||
}
|
29
tests/index.md
Normal file
29
tests/index.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
GPSLatitude: 53.115584
|
||||
GPSLongitude: -4.030248
|
||||
published: 2016-07-23T09:00:23+0000
|
||||
tags:
|
||||
- Llyn Idwal
|
||||
- winter
|
||||
- spring
|
||||
- cloudy
|
||||
- Snowdonia
|
||||
- mountain
|
||||
- clouds
|
||||
- lake
|
||||
- mountains
|
||||
- snow
|
||||
- Wales
|
||||
- water
|
||||
title: Llyn Idwal
|
||||
---
|
||||
|
||||
![](tests.jpg)
|
||||
|
||||
One can always wish for the perfect weather, yet most of the times, it remains a wish. Not this time.
|
||||
|
||||
There is a National Trust recommendation to visit Llyn Idwal, which Nora[^1] spotted, and they were right about the place: it's magnificent. We really weren't expecting snow on the mountains in May, but that, combined with the clouds and the late afternoon sunshine was just perfect.
|
||||
|
||||
I cropped the image, but apart from that, it really looked like this. No edits, no nothing.
|
||||
|
||||
[^1]: https://norahamucska.eu
|
BIN
tests/tests.jpg
Normal file
BIN
tests/tests.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
Loading…
Reference in a new issue