added created.dd and modified.dd to template system, closes #135
This commit is contained in:
21
tests/test_datetime_formatter.py
Normal file
21
tests/test_datetime_formatter.py
Normal file
@@ -0,0 +1,21 @@
|
||||
""" test datetime_formatter.DateTimeFormatter """
|
||||
import pytest
|
||||
|
||||
def test_datetime_formatter():
|
||||
import datetime
|
||||
import locale
|
||||
from osxphotos.datetime_formatter import DateTimeFormatter
|
||||
|
||||
locale.setlocale(locale.LC_ALL, "en_US")
|
||||
|
||||
dt = datetime.datetime(2020,5,23)
|
||||
dtf = DateTimeFormatter(dt)
|
||||
|
||||
assert dtf.date == "2020-05-23"
|
||||
assert dtf.year == "2020"
|
||||
assert dtf.yy == "20"
|
||||
assert dtf.month == "May"
|
||||
assert dtf.mon == "May"
|
||||
assert dtf.mm == "05"
|
||||
assert dtf.dd == "23"
|
||||
assert dtf.doy == "144"
|
||||
@@ -29,6 +29,7 @@ TEMPLATE_VALUES = {
|
||||
"{created.mm}": "02",
|
||||
"{created.month}": "February",
|
||||
"{created.mon}": "Feb",
|
||||
"{created.dd}": "04",
|
||||
"{created.doy}": "035",
|
||||
"{modified.date}": "2020-03-21",
|
||||
"{modified.year}": "2020",
|
||||
@@ -36,6 +37,7 @@ TEMPLATE_VALUES = {
|
||||
"{modified.mm}": "03",
|
||||
"{modified.month}": "March",
|
||||
"{modified.mon}": "Mar",
|
||||
"{modified.dd}": "21",
|
||||
"{modified.doy}": "081",
|
||||
"{place.name}": "Washington, District of Columbia, United States",
|
||||
"{place.country_code}": "US",
|
||||
@@ -64,6 +66,7 @@ TEMPLATE_VALUES_DEU = {
|
||||
"{created.mm}": "02",
|
||||
"{created.month}": "Februar",
|
||||
"{created.mon}": "Feb",
|
||||
"{created.dd}": "04",
|
||||
"{created.doy}": "035",
|
||||
"{modified.date}": "2020-03-21",
|
||||
"{modified.year}": "2020",
|
||||
@@ -71,6 +74,7 @@ TEMPLATE_VALUES_DEU = {
|
||||
"{modified.mm}": "03",
|
||||
"{modified.month}": "März",
|
||||
"{modified.mon}": "Mär",
|
||||
"{modified.dd}": "21",
|
||||
"{modified.doy}": "081",
|
||||
"{place.name}": "Washington, District of Columbia, United States",
|
||||
"{place.country_code}": "US",
|
||||
|
||||
Reference in New Issue
Block a user