Skip to content

Commit 95dedf7

Browse files
committed
Implemented constants for POVs.
1 parent dfbee11 commit 95dedf7

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

pointofview/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
__version__ = pkg_resources.resource_string(
1111
'pointofview', 'VERSION').decode('utf-8').strip()
1212

13+
# Constants for use in comparisons
14+
FIRST = 'first'
15+
SECOND = 'second'
16+
THIRD = 'third'
17+
NONE = None
18+
1319
# NOTE:
1420
# Words are expected to be in lower case.
1521
#
@@ -18,13 +24,13 @@
1824
# Second person PoV can also contain third person words.
1925
# Third person PoV can only contain third person words.
2026
POV_WORDS = OrderedDict([
21-
('first',
27+
(FIRST,
2228
["i", "i'm", "i'll", "i'd", "i've", "me", "mine", "myself", "we",
2329
"we're", "we'll", "we'd", "we've", "us", "ours", "ourselves"]),
24-
('second',
30+
(SECOND,
2531
["you", "you're", "you'll", "you'd", "you've",
2632
"your", "yours", "yourself", "yourselves"]),
27-
('third',
33+
(THIRD,
2834
["he", "he's", "he'll", "he'd", "him", "his", "himself", "she", "she's",
2935
"she'll", "she'd", "her", "hers", "herself", "it", "it's", "it'll",
3036
"it'd", "itself", "they", "they're", "they'll", "they'd", "they've",

tests/test_pointofview.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
# https://docs.pytest.org/en/latest/index.html
3333

3434
def test_first():
35-
assert(pointofview.get_text_pov(POV_FIRST_SINGULAR) == 'first') # nosec
36-
assert(pointofview.get_text_pov(POV_FIRST_PLURAL) == 'first') # nosec
35+
assert(pointofview.get_text_pov(POV_FIRST_SINGULAR) == pointofview.FIRST) # nosec
36+
assert(pointofview.get_text_pov(POV_FIRST_PLURAL) == pointofview.FIRST) # nosec
3737

3838
def test_second():
39-
assert(pointofview.get_text_pov(POV_SECOND) == 'second') # nosec
39+
assert(pointofview.get_text_pov(POV_SECOND) == pointofview.SECOND) # nosec
4040

4141
def test_third():
42-
assert(pointofview.get_text_pov(POV_THIRD) == 'third') # nosec
42+
assert(pointofview.get_text_pov(POV_THIRD) == pointofview.THIRD) # nosec
4343

4444
def test_none():
45-
assert(pointofview.get_text_pov(POV_NONE) == None) # nosec
45+
assert(pointofview.get_text_pov(POV_NONE) == pointofview.NONE) # nosec

0 commit comments

Comments
 (0)