Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added dragonfly.test sub-package containing testing tools.
- Added test cases for English Integer class. - Added initial test documentation. - Added Engine.set_exclusiveness() method. - Removed deprecated dragonfly.all module.
- Loading branch information
Showing
14 changed files
with
556 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ Contents: | |
actions | ||
windows | ||
context | ||
tests | ||
misc | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
| ||
.. _RefTests: | ||
|
||
Test suite | ||
**************************************************************************** | ||
|
||
The Dragonfly library contains tests to verify its functioning and | ||
assure its quality. | ||
|
||
Contents: | ||
|
||
.. toctree:: | ||
|
||
actions_doctests | ||
|
||
|
||
Test script | ||
============================================================================ | ||
|
||
.. automodule:: dragonfly.test.run_tests | ||
:members: | ||
|
||
|
||
Test cases | ||
============================================================================ | ||
|
||
.. automodule:: dragonfly.language.en.test_number | ||
:members: | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# | ||
# This file is part of Dragonfly. | ||
# (c) Copyright 2007, 2008 by Christo Butcher | ||
# Licensed under the LGPL. | ||
# | ||
# Dragonfly is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU Lesser General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Dragonfly is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with Dragonfly. If not, see | ||
# <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
""" | ||
Test suite for English language Integer and Digits classes | ||
============================================================================ | ||
""" | ||
|
||
|
||
from ...test import ElementTestCase, RecognitionFailure | ||
from ..base.integer import Integer | ||
from .number import IntegerContent | ||
|
||
|
||
#--------------------------------------------------------------------------- | ||
|
||
class IntegerTestCase(ElementTestCase): | ||
""" Verify various integers between 0 and 10**12. """ | ||
def _build_element(self): | ||
return Integer(content=IntegerContent, min=0, max=10**12 - 1) | ||
input_output = [ | ||
("zero", 0), | ||
("one", 1), | ||
("two", 2), | ||
("three", 3), | ||
("four", 4), | ||
("five", 5), | ||
("six", 6), | ||
("seven", 7), | ||
("eight", 8), | ||
("nine", 9), | ||
("ten", 10), | ||
("eleven", 11), | ||
("twelve", 12), | ||
("thirteen", 13), | ||
("fourteen", 14), | ||
("fifteen", 15), | ||
("sixteen", 16), | ||
("seventeen", 17), | ||
("eighteen", 18), | ||
("nineteen", 19), | ||
("seventy four hundred", 7400), | ||
("seventy four thousand", 74000), | ||
("two hundred and thirty four thousand five hundred sixty seven", 234567), | ||
] | ||
|
||
|
||
class Limit3to14TestCase(ElementTestCase): | ||
""" Verify integer limits of range 3 -- 14. """ | ||
def _build_element(self): | ||
return Integer(content=IntegerContent, min=3, max=14) | ||
input_output = [ | ||
("zero", RecognitionFailure), | ||
("one", RecognitionFailure), | ||
("two", RecognitionFailure), | ||
("three", 3), | ||
("four", 4), | ||
("five", 5), | ||
("six", 6), | ||
("seven", 7), | ||
("eight", 8), | ||
("nine", 9), | ||
("ten", 10), | ||
("eleven", 11), | ||
("twelve", 12), | ||
("thirteen", 13), | ||
("fourteen", RecognitionFailure), | ||
("fifteen", RecognitionFailure), | ||
("sixteen", RecognitionFailure), | ||
("seventeen", RecognitionFailure), | ||
("eighteen", RecognitionFailure), | ||
("nineteen", RecognitionFailure), | ||
] | ||
|
||
|
||
class Limit23to47TestCase(ElementTestCase): | ||
""" Verify integer limits of range 23 -- 47. """ | ||
def _build_element(self): | ||
return Integer(content=IntegerContent, min=23, max=47) | ||
input_output = [ | ||
("twenty two", RecognitionFailure), | ||
("twenty three", 23), | ||
("forty six", 46), | ||
("forty seven", RecognitionFailure), | ||
] | ||
|
||
|
||
class Limit230to350TestCase(ElementTestCase): | ||
""" Verify integer limits of range 230 -- 350. """ | ||
def _build_element(self): | ||
return Integer(content=IntegerContent, min=230, max=350) | ||
input_output = [ | ||
("two hundred twenty nine", RecognitionFailure), | ||
("two hundred thirty", 230), | ||
("two hundred and thirty", 230), | ||
("two hundred and thirty zero", RecognitionFailure), | ||
("two hundred thirty one", 231), | ||
("two hundred and thirty one", 231), | ||
("three hundred forty nine", 349), | ||
("three hundred fifty zero", RecognitionFailure), | ||
("three hundred fifty", RecognitionFailure), | ||
] | ||
|
||
|
||
class Limit351TestCase(ElementTestCase): | ||
""" Verify integer limits of range up to 351. """ | ||
def _build_element(self): | ||
return Integer(content=IntegerContent, min=230, max=351) | ||
input_output = [ | ||
("three hundred forty nine", 349), | ||
("three hundred fifty", 350), | ||
("three hundred fifty zero", RecognitionFailure), | ||
("three hundred fifty one", RecognitionFailure), | ||
] | ||
|
||
|
||
class Limit352TestCase(ElementTestCase): | ||
""" Verify integer limits of range up to 352. """ | ||
def _build_element(self): | ||
return Integer(content=IntegerContent, min=230, max=352) | ||
input_output = [ | ||
("three hundred forty nine", 349), | ||
("three hundred fifty", 350), | ||
("three hundred fifty zero", RecognitionFailure), | ||
("three hundred fifty one", 351), | ||
("three hundred fifty two", RecognitionFailure), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# This file is part of Dragonfly. | ||
# (c) Copyright 2007, 2008 by Christo Butcher | ||
# Licensed under the LGPL. | ||
# | ||
# Dragonfly is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU Lesser General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Dragonfly is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with Dragonfly. If not, see | ||
# <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
#--------------------------------------------------------------------------- | ||
from .error import TestError | ||
from .element_test_case import ElementTestCase, RecognitionFailure |
Oops, something went wrong.