Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
8df3a1a
Added pdtContext.fromAccuracyStrings to allow a string representation…
idpaterson Sep 21, 2016
6adb275
Added ACU_WILDCARD to support a wildcard pdtContext that will match a…
idpaterson Sep 21, 2016
8717a5a
Removed old tests
idpaterson Sep 21, 2016
422a775
Added test data parsing and fixtures
idpaterson Sep 21, 2016
1dc7127
Added a few tests
idpaterson Sep 22, 2016
cd4a753
Added explicit datedelta, nlpTarget, and nlpTargetValue classes to te…
idpaterson Sep 26, 2016
784a463
Merge branch 'v3.0' into pull-requests/pytest-yaml
idpaterson Sep 27, 2016
cf3fe6e
Use nlpTarget to wrap plain target values and added support for inval…
idpaterson Sep 27, 2016
01371cf
Added nlp tests
idpaterson Sep 27, 2016
7eafcc2
Added some of the simple datetime tests
idpaterson Sep 28, 2016
4e5a6a5
Changed “cal” fixture to “calendar”
idpaterson Nov 22, 2016
4133253
Migrated functions in tests/fixtures to TestGroup and TestCase classe…
idpaterson Nov 22, 2016
5efd022
Updated tests to use !replace rather than explicit dates
idpaterson Nov 22, 2016
57a24fa
Ported noon and midnight test cases
idpaterson Nov 23, 2016
73f1080
Ported TestPhrases
idpaterson Nov 23, 2016
83a6db0
Added YAML support for setting attributes on the Constants instance.
idpaterson Nov 24, 2016
0cdf98f
Finished phrases tests
idpaterson Nov 24, 2016
5c7119b
Began simple offset tests which required setting options on Constants
idpaterson Nov 24, 2016
7b53245
Avoid left-padding numbers with zeroes for compatibility with python 3.
idpaterson Nov 24, 2016
638e351
Updated .editorconfig for YAML files
idpaterson Nov 27, 2016
e4505d3
Ported TestComplexDatetimes
idpaterson Nov 27, 2016
3090c2c
Added support for a list of targets as needed for evalRanges
idpaterson Nov 27, 2016
481128d
Ported TestRanges
idpaterson Nov 27, 2016
0ed57e5
Minor code style fixes
idpaterson Nov 27, 2016
c4abb7c
Reworked nlp tests to use multiple and/or default dates, fixed glitch…
idpaterson Nov 28, 2016
7883631
Merge branch ‘v3.0’ into pull-requests/pytest-yaml
idpaterson Nov 28, 2016
ed80740
Added support for a single sourceTime value on test cases
idpaterson Nov 28, 2016
20260c9
Completed port of TestSimpleOffsets
idpaterson Nov 28, 2016
0ed0010
Completed simple date time tests which were awaiting the syntax to se…
idpaterson Dec 2, 2016
294b491
Added support for day_start_hour, which is an argument to Calendar ra…
idpaterson Feb 27, 2017
36fcf9e
Ported TestDayStartHour
idpaterson Feb 27, 2017
290831a
Added midnight tests for day_start_hour
idpaterson Feb 27, 2017
499f058
Ported TestSimpleOffsetsHours
idpaterson Feb 27, 2017
3043e7b
Ported TestStartTimeFromSourceTime
idpaterson Feb 27, 2017
af813ae
Ported TestUnits
idpaterson Feb 27, 2017
c1cfd8b
Ported TestErrors
idpaterson Feb 27, 2017
498e1e1
Fixed abysmal coverage due to not actually running the tests
idpaterson Feb 27, 2017
67b52a8
Ported TestSimpleOffsetsNoon
idpaterson Feb 28, 2017
ec2450d
Ported TestInc
idpaterson Feb 28, 2017
bcbd248
flake8 cleanup
idpaterson Feb 28, 2017
f792382
Added test cases for datedelta and improved consistency of its string…
idpaterson Mar 1, 2017
b20334d
Added tests for dateReplacement
idpaterson Mar 1, 2017
8ff819a
Added tests for nlpTargetValue
idpaterson Mar 3, 2017
bb5586e
Added test utilities to coverage test
idpaterson Mar 3, 2017
4cdca9e
Added a few tests to improve coverage of datedelta and dateReplacement
idpaterson Mar 3, 2017
d309971
Test datedelta argument type errors
idpaterson Mar 7, 2017
1506566
Reorganized test lib files and tests to keep the parsedatetime tests …
idpaterson Mar 7, 2017
188be6a
Test data directory is now relative to the test file
idpaterson Mar 8, 2017
a97f596
Added tests for pdtFixture
idpaterson Mar 8, 2017
d085d9d
Additional tests for number words
idpaterson Mar 8, 2017
205925f
Added a few tests for nlpTarget where lacking coverage
idpaterson Mar 8, 2017
f6b15e9
Re-raise YAML loading errors to avoid silent failure
idpaterson Mar 9, 2017
ff924e0
Removed xfail tests that end up skipped in favor of more direct testing
idpaterson Mar 9, 2017
692cf9a
Fixed parametrization when only one parameter is requested
idpaterson Mar 9, 2017
dae6415
Added a “case” fixture to get the TestCase instance to simplify metat…
idpaterson Mar 9, 2017
c78178d
Treat skipped tests as errors and note when the skip may be due to a …
idpaterson Mar 9, 2017
108b19f
Added some metatests to achieve full coverage of the test lib
idpaterson Mar 9, 2017
01122f7
Split data module into data and models since the models are not direc…
idpaterson Mar 9, 2017
4283265
Split tests.lib.data into two modules, models and data, to keep the y…
idpaterson Mar 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[run]
branch = True
source = parsedatetime
include =
parsedatetime/*
tests/lib/*
omit =
tests/*/test_*
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ root = true
[*.py]
indent_style = space
indent_size = 4

[*.yml]
indent_style = space
indent_size = 4
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ tox: clean
tox

coverage: clean
@coverage run --source=parsedatetime setup.py test
@coverage run setup.py test
@coverage html
@coverage report

Expand Down
18 changes: 17 additions & 1 deletion parsedatetime/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class pdtContext(object):
ACU_MIN = 2 ** 6
ACU_SEC = 2 ** 7
ACU_NOW = 2 ** 8
ACU_WILDCARD = 2 ** 9

ACU_DATE = ACU_YEAR | ACU_MONTH | ACU_WEEK | ACU_DAY
ACU_TIME = ACU_HALFDAY | ACU_HOUR | ACU_MIN | ACU_SEC | ACU_NOW
Expand Down Expand Up @@ -116,6 +117,15 @@ class pdtContext(object):
'seconds': ACU_SEC,
'now': ACU_NOW}

@classmethod
def fromAccuracyStrings(cls, accuracyStrings):
accuracy = 0
for accuracyString in accuracyStrings:
if accuracyString in cls._ACCURACY_REVERSE_MAPPING:
accuracy |= cls._ACCURACY_REVERSE_MAPPING[accuracyString]

return cls(accuracy)

def __init__(self, accuracy=0):
"""
Default constructor of L{pdtContext} class.
Expand Down Expand Up @@ -184,4 +194,10 @@ def __repr__(self):
return 'pdtContext(%s)' % accuracy_repr

def __eq__(self, ctx):
return self.accuracy == ctx.accuracy
if not isinstance(ctx, pdtContext):
return False
return (
self.accuracy == ctx.accuracy or
self.accuracy == self.ACU_WILDCARD or
ctx.accuracy == self.ACU_WILDCARD
)
3 changes: 2 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[pytest]
norecursedirs = venv .tox
testpaths = tests
verbosity = 2
python_files=Test*.py
python_files=test_*.py

with-coverage = true
cover-min-percentage = 72
Expand Down
3 changes: 2 additions & 1 deletion requirements.testing.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
pytest
pytest-cov
pytest-mock
pytest-runner
pyyaml
mccabe
flake8
coverage
coveralls
codecov
check-manifest
unittest2
tox
tox-pyenv
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ ignore =
violations.flake8.txt

[flake8]
ignore = E111,E124,E126,E201,E202,E221,E241,E302,E501
ignore = E111,E124,E126,E201,E202,E221,E241,E302,E501

[aliases]
test=pytest
130 changes: 0 additions & 130 deletions tests/TestAlternativeAbbreviations.py

This file was deleted.

111 changes: 0 additions & 111 deletions tests/TestAustralianLocale.py

This file was deleted.

Loading