Skip to content

Commit bd12790

Browse files
committed
Adds escape tests for AlternativeFormatter class.
1 parent 4b6c5ae commit bd12790

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/formatting_tests/test_alternative_formatter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,9 @@ def test_timestamp(self):
145145
d = Pendulum(1970, 1, 1)
146146
self.assertEqual('0', f.format(d, 'X'))
147147
self.assertEqual('86400', f.format(d.add(days=1), 'X'))
148+
149+
def test_escape(self):
150+
f = AlternativeFormatter()
151+
d = Pendulum(2016, 8, 28)
152+
self.assertEqual('YYYY 2016 [2016]', f.format(d, '[YYYY] YYYY \[YYYY\]'))
153+
self.assertEqual('D 28 \\28', f.format(d, '\D D \\\D'))

0 commit comments

Comments
 (0)