instance_id
stringlengths 10
57
| patch
stringlengths 261
37.7k
| repo
stringlengths 7
53
| base_commit
stringlengths 40
40
| hints_text
stringclasses 301
values | test_patch
stringlengths 212
2.22M
| problem_statement
stringlengths 23
37.7k
| version
stringclasses 1
value | environment_setup_commit
stringlengths 40
40
| FAIL_TO_PASS
listlengths 1
4.94k
| PASS_TO_PASS
listlengths 0
7.82k
| meta
dict | created_at
stringlengths 25
25
| license
stringclasses 8
values | __index_level_0__
int64 0
6.41k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
codingedward__flask-sieve-30 | diff --git a/flask_sieve/rules_processor.py b/flask_sieve/rules_processor.py
index 1fee1ba..a850531 100644
--- a/flask_sieve/rules_processor.py
+++ b/flask_sieve/rules_processor.py
@@ -547,7 +547,7 @@ class RulesProcessor:
return True
value = self._attribute_value(attribute)
is_optional = self._has_rule(rules, 'sometimes')
- if is_optional and value is not None:
+ if is_optional and value is None:
return True
attribute_conditional_rules = list(filter(lambda rule: rule['name'] in conditional_inclusion_rules, rules))
diff --git a/watch.sh b/watch.sh
index 340fb07..7c86b5b 100755
--- a/watch.sh
+++ b/watch.sh
@@ -1,3 +1,3 @@
#!/bin/bash
-watchman-make -p "**/*.py" --run "nosetests --with-coverage --cover-package flask_sieve"
+watchman-make -p "**/*.py" --run "rm .coverage; nosetests --with-coverage --cover-package flask_sieve"
| codingedward/flask-sieve | 06ae5fb1dbeae4c6d476cac4f62c50c8d53ae60e | diff --git a/tests/test_rules_processor.py b/tests/test_rules_processor.py
index 167145c..eeafd0f 100644
--- a/tests/test_rules_processor.py
+++ b/tests/test_rules_processor.py
@@ -935,6 +935,45 @@ class TestRulesProcessor(unittest.TestCase):
request={}
)
+ def test_validates_sometimes(self):
+ self.assert_passes(
+ rules={'number': ['sometimes', 'max:5']},
+ request={}
+ )
+ self.assert_passes(
+ rules={'number': ['sometimes', 'max:5']},
+ request={'number': 2}
+ )
+ self.assert_fails(
+ rules={'number': ['sometimes', 'max:5']},
+ request={'number': ''}
+ )
+ self.assert_fails(
+ rules={'number': ['sometimes', 'max:5']},
+ request={'number': 10}
+ )
+ self.assert_passes(
+ rules={
+ 'zipCode': ['sometimes', 'numeric'],
+ 'website': ['sometimes', 'url']
+ },
+ request={}
+ )
+ self.assert_passes(
+ rules={
+ 'zipCode': ['sometimes', 'numeric'],
+ 'website': ['sometimes', 'url']
+ },
+ request={'website': 'https://google.com'}
+ )
+ self.assert_fails(
+ rules={
+ 'zipCode': ['sometimes', 'numeric'],
+ 'website': ['sometimes', 'url']
+ },
+ request={'website': 'ogle.com'}
+ )
+
def test_validates_uuid(self):
self.assert_passes(
diff --git a/tests/test_validator.py b/tests/test_validator.py
index fecfe45..9079d9d 100644
--- a/tests/test_validator.py
+++ b/tests/test_validator.py
@@ -184,41 +184,6 @@ class TestValidator(unittest.TestCase):
params_count=0
)
- def test_sometimes_request(self):
- self.set_validator_params(
- rules={'number': ['sometimes', 'max:5']},
- request={}
- )
- self.assertTrue(self._validator.passes())
-
- self.set_validator_params(
- rules={'number': ['sometimes', 'max:5']},
- request={'number': ''}
- )
- self.assertTrue(self._validator.fails())
- self.assertDictEqual({
- 'number': [
- 'The number could not be validated since it is empty.'
- ]
- }, self._validator.messages())
-
- self.set_validator_params(
- rules={'number': ['sometimes', 'max:5']},
- request={'number': 2}
- )
- self.assertTrue(self._validator.passes())
-
- self.set_validator_params(
- rules={'number': ['sometimes', 'max:5']},
- request={'number': 10}
- )
- self.assertTrue(self._validator.fails())
- self.assertDictEqual({
- 'number': [
- 'The number may not be greater than 5.'
- ]
- }, self._validator.messages())
-
def set_validator_params(self, rules=None, request=None):
rules = rules or {}
request = request or {}
| sometimes not working
sometimes rule not working with other rules.
'zipCode': ['sometimes', 'numeric'],
'website': ['sometimes', 'url']
if we leave blank any of the field, it ask for valid integer and valid url. | 0.0 | 06ae5fb1dbeae4c6d476cac4f62c50c8d53ae60e | [
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_sometimes"
]
| [
"tests/test_rules_processor.py::TestRulesProcessor::test_allows_nullable_fields",
"tests/test_rules_processor.py::TestRulesProcessor::test_assert_params_size",
"tests/test_rules_processor.py::TestRulesProcessor::test_compare_dates",
"tests/test_rules_processor.py::TestRulesProcessor::test_custom_handlers",
"tests/test_rules_processor.py::TestRulesProcessor::test_get_rule_handler",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_accepted",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_active_url",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_after",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_after_or_equal",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha_dash",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha_num",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_array",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_before",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_before_or_equal",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_between",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_boolean",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_confirmed",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_date",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_date_equals",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_different",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_digits",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_digits_between",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_dimensions",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_distinct",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_email",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_exists",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_extension",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_file",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_filled",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_gt",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_gte",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_image",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_in",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_in_array",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_integer",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ip",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ipv4",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ipv6",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_json",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_lt",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_lte",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_max",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_mime_types",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_min",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_not_in",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_not_regex",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_numeric",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_present",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_regex",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_if",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_multiple_required_withouts",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_unless",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_with",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_with_all",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_without",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_without_all",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_same",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_size",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_starts_with",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_string",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_timezone",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_unique",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_url",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_uuid",
"tests/test_validator.py::TestValidator::test_cannot_set_custom_handler_without_validate_keyword",
"tests/test_validator.py::TestValidator::test_handles_different_types_of_requests",
"tests/test_validator.py::TestValidator::test_translates_validations",
"tests/test_validator.py::TestValidator::test_translates_validations_set_through_custom_handlers",
"tests/test_validator.py::TestValidator::test_translates_validations_with_all_params",
"tests/test_validator.py::TestValidator::test_translates_validations_with_custom_handler",
"tests/test_validator.py::TestValidator::test_translates_validations_with_custom_messages",
"tests/test_validator.py::TestValidator::test_translates_validations_with_custom_messages_on_constructor",
"tests/test_validator.py::TestValidator::test_translates_validations_with_param",
"tests/test_validator.py::TestValidator::test_translates_validations_with_rest_params",
"tests/test_validator.py::TestValidator::test_validate_decorator"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-03-01 00:17:56+00:00 | mit | 1,627 |
|
codingedward__flask-sieve-31 | diff --git a/flask_sieve/exceptions.py b/flask_sieve/exceptions.py
index d5c6dc7..088ead6 100644
--- a/flask_sieve/exceptions.py
+++ b/flask_sieve/exceptions.py
@@ -13,7 +13,7 @@ def register_error_handler(app):
'errors': ex.errors
}
- if app.config.get('SIEVE_INCLUDE_SUCCESS_KEY'):
+ if app.config.get('SIEVE_INCLUDE_SUCCESS_KEY', True):
response['success'] = False
if app.config.get('SIEVE_RESPONSE_WRAPPER'):
diff --git a/watch.sh b/watch.sh
index 7c86b5b..daaf9ad 100755
--- a/watch.sh
+++ b/watch.sh
@@ -1,3 +1,3 @@
#!/bin/bash
-watchman-make -p "**/*.py" --run "rm .coverage; nosetests --with-coverage --cover-package flask_sieve"
+watchman-make -p "**/*.py" --run "rm .coverage; nosetests --nocapture --with-coverage --cover-package flask_sieve"
| codingedward/flask-sieve | 28537dfe9bd9306aa2035ef3cd3182c00f3855df | diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py
index a5abf83..ff698a3 100644
--- a/tests/test_exceptions.py
+++ b/tests/test_exceptions.py
@@ -33,6 +33,19 @@ class TestErrorHandler(unittest.TestCase):
self.assertEqual(422, status)
self.assertIn('Test error', str(response.get_json()))
+ def test_default_response_message(self):
+ app = Flask(__name__)
+ register_error_handler(app)
+ self.assertIn(ValidationException, app.error_handler_spec[None][None])
+ errors = {'field': 'Test error'}
+
+ with app.app_context():
+ response, status = app.error_handler_spec[None][None][ValidationException](
+ ValidationException(errors)
+ )
+ self.assertEqual(400, status)
+ self.assertIn('Validation error', str(response.get_json()))
+
def test_configuring_response_message(self):
app = Flask(__name__)
msg = "Only Chuck Norris can submit invalid data!"
@@ -63,7 +76,35 @@ class TestErrorHandler(unittest.TestCase):
self.assertEqual(400, status)
self.assertTrue('success' in response.get_json())
- def test_keeping_removing_message(self):
+ def test_keeping_success_message(self):
+ app = Flask(__name__)
+ app.config['SIEVE_INCLUDE_SUCCESS_KEY'] = True
+
+ register_error_handler(app)
+ self.assertIn(ValidationException, app.error_handler_spec[None][None])
+ errors = {'field': 'Test error'}
+
+ with app.app_context():
+ response, status = app.error_handler_spec[None][None][ValidationException](
+ ValidationException(errors)
+ )
+ self.assertEqual(400, status)
+ self.assertTrue('success' in response.get_json())
+
+ def test_having_success_message_by_default(self):
+ app = Flask(__name__)
+ register_error_handler(app)
+ self.assertIn(ValidationException, app.error_handler_spec[None][None])
+ errors = {'field': 'Test error'}
+
+ with app.app_context():
+ response, status = app.error_handler_spec[None][None][ValidationException](
+ ValidationException(errors)
+ )
+ self.assertEqual(400, status)
+ self.assertTrue('success' in response.get_json())
+
+ def test_removing_success_message(self):
app = Flask(__name__)
app.config['SIEVE_INCLUDE_SUCCESS_KEY'] = False
diff --git a/tests/test_rules_processor.py b/tests/test_rules_processor.py
index eeafd0f..15cf856 100644
--- a/tests/test_rules_processor.py
+++ b/tests/test_rules_processor.py
@@ -1039,12 +1039,14 @@ class TestRulesProcessor(unittest.TestCase):
self._assert(rules, request, True)
def _assert(self, rules, request, passes):
- p = self.parser
- v = self.processor
- v.set_request(request)
- p.set_rules(rules)
- v.set_rules(p.parsed_rules())
- self.assertTrue(v.passes() if passes else v.fails())
+ self.processor.set_request(request)
+ self.parser.set_rules(rules)
+ self.processor.set_rules(self.parser.parsed_rules())
+ if passes:
+ self.assertTrue(self.processor.passes())
+ else:
+ self.assertTrue(self.processor.fails())
+
def tearDown(self):
self.stream.close()
| Custom Validation Error format Issue
As per documentation error response default format is
success: False,
message: 'Validation error',
errors: {
'email': [
'The email is required.',
'The email must be a valid email address.'
],
'password': [
'The password confirmation does not match.'
]
}
}
**But I am receiving below given. There is no success: false and message : validation errors**
{
"email": [
"The email field is required.",
"The email must be a valid email address."
],
"firstName": [
"The firstName field is required.",
"The firstName may only contain letters and numbers."
],
"lastName": [
"The lastName field is required.",
"The lastName may only contain letters and numbers."
]
}
| 0.0 | 28537dfe9bd9306aa2035ef3cd3182c00f3855df | [
"tests/test_exceptions.py::TestErrorHandler::test_having_success_message_by_default"
]
| [
"tests/test_exceptions.py::TestErrorHandler::test_configurable_status_code",
"tests/test_exceptions.py::TestErrorHandler::test_configuring_response_message",
"tests/test_exceptions.py::TestErrorHandler::test_default_response_message",
"tests/test_exceptions.py::TestErrorHandler::test_error_handler",
"tests/test_exceptions.py::TestErrorHandler::test_keeping_success_message",
"tests/test_exceptions.py::TestErrorHandler::test_removing_success_message",
"tests/test_exceptions.py::TestErrorHandler::test_wrapping_response_with_data",
"tests/test_exceptions.py::TestErrorHandler::test_wrapping_response_without_data",
"tests/test_rules_processor.py::TestRulesProcessor::test_allows_nullable_fields",
"tests/test_rules_processor.py::TestRulesProcessor::test_assert_params_size",
"tests/test_rules_processor.py::TestRulesProcessor::test_compare_dates",
"tests/test_rules_processor.py::TestRulesProcessor::test_custom_handlers",
"tests/test_rules_processor.py::TestRulesProcessor::test_get_rule_handler",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_accepted",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_active_url",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_after",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_after_or_equal",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha_dash",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha_num",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_array",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_before",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_before_or_equal",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_between",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_boolean",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_confirmed",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_date",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_date_equals",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_different",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_digits",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_digits_between",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_dimensions",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_distinct",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_email",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_exists",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_extension",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_file",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_filled",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_gt",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_gte",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_image",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_in",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_in_array",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_integer",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ip",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ipv4",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ipv6",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_json",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_lt",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_lte",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_max",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_mime_types",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_min",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_not_in",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_not_regex",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_numeric",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_present",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_regex",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_if",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_multiple_required_withouts",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_unless",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_with",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_with_all",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_without",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_without_all",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_same",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_size",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_sometimes",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_starts_with",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_string",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_timezone",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_unique",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_url",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_uuid"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-03-01 01:05:55+00:00 | mit | 1,628 |
|
codingedward__flask-sieve-32 | diff --git a/flask_sieve/rules_processor.py b/flask_sieve/rules_processor.py
index a850531..1ebae7a 100644
--- a/flask_sieve/rules_processor.py
+++ b/flask_sieve/rules_processor.py
@@ -246,10 +246,6 @@ class RulesProcessor:
def validate_file(value, **kwargs):
return isinstance(value, FileStorage)
- @staticmethod
- def validate_empty(value, **kwargs):
- return value == ''
-
def validate_filled(self, value, attribute, nullable, **kwargs):
if self.validate_present(attribute):
return self.validate_required(value, attribute, nullable)
@@ -368,7 +364,7 @@ class RulesProcessor:
def validate_lt(self, value, params, **kwargs):
self._assert_params_size(size=1, params=params, rule='lt')
- if value == '':
+ if self._is_value_empty(value):
return False
value = self._get_size(value)
lower = self._get_size(self._attribute_value(params[0]))
@@ -376,7 +372,7 @@ class RulesProcessor:
def validate_lte(self, value, params, **kwargs):
self._assert_params_size(size=1, params=params, rule='lte')
- if value == '':
+ if self._is_value_empty(value):
return False
value = self._get_size(value)
lower = self._get_size(self._attribute_value(params[0]))
@@ -384,7 +380,7 @@ class RulesProcessor:
def validate_max(self, value, params, **kwargs):
self._assert_params_size(size=1, params=params, rule='max')
- if value == '':
+ if self._is_value_empty(value):
return False
value = self._get_size(value)
upper = self._get_size(params[0])
@@ -437,7 +433,7 @@ class RulesProcessor:
return re.match(params[0], value)
def validate_required(self, value, attribute, nullable, **kwargs):
- if not value and not nullable:
+ if (not value and value != False and value != 0) and not nullable:
return False
return self.validate_present(attribute)
@@ -636,7 +632,7 @@ class RulesProcessor:
return 'array'
elif self.validate_file(value):
return 'file'
- elif self.validate_empty(value):
+ elif self._is_value_empty(value):
return 'empty'
return 'string'
@@ -655,6 +651,10 @@ class RulesProcessor:
request_param = request_param[accessor]
return request_param
+ @staticmethod
+ def _is_value_empty(value, **kwargs):
+ return (not value and value != 0)
+
@staticmethod
def _assert_params_size(size, params, rule):
if size > len(params):
| codingedward/flask-sieve | 936cafdc73e49931e133c1f8f7edbbd3ee5c89ca | diff --git a/tests/test_rules_processor.py b/tests/test_rules_processor.py
index 15cf856..0e0f939 100644
--- a/tests/test_rules_processor.py
+++ b/tests/test_rules_processor.py
@@ -549,6 +549,14 @@ class TestRulesProcessor(unittest.TestCase):
rules={'field': ['lt:field_2']},
request={'field': 10, 'field_2': 1}
)
+ self.assert_fails(
+ rules={'field': ['lt:field_2']},
+ request={'field': None, 'field_2': 1}
+ )
+ self.assert_fails(
+ rules={'field': ['lt:field_2']},
+ request={'field': '', 'field_2': 1}
+ )
def test_validates_lte(self):
self.assert_passes(
@@ -563,6 +571,10 @@ class TestRulesProcessor(unittest.TestCase):
rules={'field': ['lte:field_2']},
request={'field': 10, 'field_2': 1}
)
+ self.assert_fails(
+ rules={'field': ['lte:field_2']},
+ request={'field': None, 'field_2': 1}
+ )
def test_validates_max(self):
self.assert_passes(
@@ -573,6 +585,14 @@ class TestRulesProcessor(unittest.TestCase):
rules={'field': ['max:10']},
request={'field': 30}
)
+ self.assert_passes(
+ rules={'field': ['max:10']},
+ request={'field': 0}
+ )
+ self.assert_fails(
+ rules={'field': ['max:10']},
+ request={'field': None}
+ )
def test_validates_mime_types(self):
self.assert_passes(
@@ -685,6 +705,14 @@ class TestRulesProcessor(unittest.TestCase):
rules={'field': ['required']},
request={'field': None}
)
+ self.assert_passes(
+ rules={'field': ['required']},
+ request={'field': False}
+ )
+ self.assert_passes(
+ rules={'field': ['required']},
+ request={'field': 0}
+ )
def test_validates_required_if(self):
self.assert_passes(
@@ -935,45 +963,6 @@ class TestRulesProcessor(unittest.TestCase):
request={}
)
- def test_validates_sometimes(self):
- self.assert_passes(
- rules={'number': ['sometimes', 'max:5']},
- request={}
- )
- self.assert_passes(
- rules={'number': ['sometimes', 'max:5']},
- request={'number': 2}
- )
- self.assert_fails(
- rules={'number': ['sometimes', 'max:5']},
- request={'number': ''}
- )
- self.assert_fails(
- rules={'number': ['sometimes', 'max:5']},
- request={'number': 10}
- )
- self.assert_passes(
- rules={
- 'zipCode': ['sometimes', 'numeric'],
- 'website': ['sometimes', 'url']
- },
- request={}
- )
- self.assert_passes(
- rules={
- 'zipCode': ['sometimes', 'numeric'],
- 'website': ['sometimes', 'url']
- },
- request={'website': 'https://google.com'}
- )
- self.assert_fails(
- rules={
- 'zipCode': ['sometimes', 'numeric'],
- 'website': ['sometimes', 'url']
- },
- request={'website': 'ogle.com'}
- )
-
def test_validates_uuid(self):
self.assert_passes(
| Boolean is showing required if pass value false or 0
Hi Team,
Boolean is showing validation fail if I pass the value false or zero.
Please try to resolve these bug ASAP or please also make me the contributor. so that i can fix these too.
My Request Data :
{
"UUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"adminLeadRecruiter": false,
"adminAsDcm": false,
"leadRecruiters": [
"[email protected]",
"[email protected]"
],
"recruiters": [
"[email protected]",
"[email protected]"
],
"dcm": "[email protected]"
}
**Response :-**
"errors": {
"adminAsDcm": [
"The adminAsDcm field is required."
],
"adminLeadRecruiter": [
"The adminLeadRecruiter field is required."
]
},
| 0.0 | 936cafdc73e49931e133c1f8f7edbbd3ee5c89ca | [
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_max",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required"
]
| [
"tests/test_rules_processor.py::TestRulesProcessor::test_allows_nullable_fields",
"tests/test_rules_processor.py::TestRulesProcessor::test_assert_params_size",
"tests/test_rules_processor.py::TestRulesProcessor::test_compare_dates",
"tests/test_rules_processor.py::TestRulesProcessor::test_custom_handlers",
"tests/test_rules_processor.py::TestRulesProcessor::test_get_rule_handler",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_accepted",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_active_url",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_after",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_after_or_equal",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha_dash",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha_num",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_array",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_before",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_before_or_equal",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_between",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_boolean",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_confirmed",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_date",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_date_equals",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_different",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_digits",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_digits_between",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_dimensions",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_distinct",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_email",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_exists",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_extension",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_file",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_filled",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_gt",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_gte",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_image",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_in",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_in_array",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_integer",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ip",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ipv4",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ipv6",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_json",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_lt",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_lte",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_mime_types",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_min",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_not_in",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_not_regex",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_numeric",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_present",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_regex",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_if",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_multiple_required_withouts",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_unless",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_with",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_with_all",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_without",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_without_all",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_same",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_size",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_starts_with",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_string",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_timezone",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_unique",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_url",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_uuid"
]
| {
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2021-03-01 02:01:14+00:00 | mit | 1,629 |
|
codingedward__flask-sieve-37 | diff --git a/.gitignore b/.gitignore
index fb871be..88ecb85 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
.*.swn
.*.swo
.*.swp
+.vim
.coverage
docs/build
.DS_Store
diff --git a/flask_sieve/rules_processor.py b/flask_sieve/rules_processor.py
index 1ebae7a..7b7f004 100644
--- a/flask_sieve/rules_processor.py
+++ b/flask_sieve/rules_processor.py
@@ -152,9 +152,9 @@ class RulesProcessor:
self._assert_params_size(size=1, params=params, rule='before_or_equal')
return self._compare_dates(value, params[0], operator.le)
- def validate_between(self, value, params, **kwargs):
+ def validate_between(self, value, params, rules, **kwargs):
self._assert_params_size(size=2, params=params, rule='between')
- value = self._get_size(value)
+ value = self._get_size(value, rules)
lower = self._get_size(params[0])
upper = self._get_size(params[1])
return lower <= value and value <= upper
@@ -251,15 +251,15 @@ class RulesProcessor:
return self.validate_required(value, attribute, nullable)
return True
- def validate_gt(self, value, params, **kwargs):
+ def validate_gt(self, value, params, rules, **kwargs):
self._assert_params_size(size=1, params=params, rule='gt')
- value = self._get_size(value)
+ value = self._get_size(value, rules)
upper = self._get_size(self._attribute_value(params[0]))
return value > upper
- def validate_gte(self, value, params, **kwargs):
+ def validate_gte(self, value, params, rules, **kwargs):
self._assert_params_size(size=1, params=params, rule='gte')
- value = self._get_size(value)
+ value = self._get_size(value, rules)
upper = self._get_size(self._attribute_value(params[0]))
return value >= upper
@@ -362,27 +362,27 @@ class RulesProcessor:
def validate_json(self, value, **kwargs):
return self._can_call_with_method(json.loads, value)
- def validate_lt(self, value, params, **kwargs):
+ def validate_lt(self, value, params, rules, **kwargs):
self._assert_params_size(size=1, params=params, rule='lt')
if self._is_value_empty(value):
return False
- value = self._get_size(value)
+ value = self._get_size(value, rules)
lower = self._get_size(self._attribute_value(params[0]))
return value < lower
- def validate_lte(self, value, params, **kwargs):
+ def validate_lte(self, value, params, rules, **kwargs):
self._assert_params_size(size=1, params=params, rule='lte')
if self._is_value_empty(value):
return False
- value = self._get_size(value)
+ value = self._get_size(value, rules)
lower = self._get_size(self._attribute_value(params[0]))
return value <= lower
- def validate_max(self, value, params, **kwargs):
+ def validate_max(self, value, params, rules, **kwargs):
self._assert_params_size(size=1, params=params, rule='max')
if self._is_value_empty(value):
return False
- value = self._get_size(value)
+ value = self._get_size(value, rules)
upper = self._get_size(params[0])
return value <= upper
@@ -396,9 +396,9 @@ class RulesProcessor:
return value.mimetype in params
return kind.mime in params
- def validate_min(self, value, params, **kwargs):
+ def validate_min(self, value, params, rules, **kwargs):
self._assert_params_size(size=1, params=params, rule='min')
- value = self._get_size(value)
+ value = self._get_size(value, rules)
lower = self._get_size(params[0])
return value >= lower
@@ -487,7 +487,7 @@ class RulesProcessor:
other_value = self._attribute_value(params[0])
return value == other_value
- def validate_size(self, value, params, **kwargs):
+ def validate_size(self, value, params, rules, **kwargs):
self._assert_params_size(size=1, params=params, rule='size')
self._assert_with_method(float, params[0])
other_value = params[0]
@@ -495,7 +495,7 @@ class RulesProcessor:
other_value = float(other_value)
else:
other_value = int(other_value)
- return self._get_size(value) == other_value
+ return self._get_size(value, rules) == other_value
def validate_starts_with(self, value, params, **kwargs):
self._assert_params_size(size=1, params=params, rule='starts_with')
diff --git a/setup.py b/setup.py
index a360d6e..eec224a 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ setup(
name='flask-sieve',
description='A Laravel inspired requests validator for Flask',
long_description='Find the documentation at https://flask-sieve.readthedocs.io/en/latest/',
- version='2.0.0',
+ version='2.0.1',
url='https://github.com/codingedward/flask-sieve',
license='BSD-2',
author='Edward Njoroge',
| codingedward/flask-sieve | 6ac6e87aedad48be2eddb5473321336efa0e02fa | diff --git a/tests/test_rules_processor.py b/tests/test_rules_processor.py
index 3f32a1b..999b31b 100644
--- a/tests/test_rules_processor.py
+++ b/tests/test_rules_processor.py
@@ -597,6 +597,11 @@ class TestRulesProcessor(unittest.TestCase):
rules={'field': ['max:10']},
request={'field': self.image_file}
)
+ self.assert_passes(
+ rules={'field': ['bail', 'required', 'string', 'max:10'],
+ 'card_cvv': ['bail', 'required', 'string', 'max:8']},
+ request={'field': '8777745434', 'card_cvv': '123'}
+ )
def test_validates_mime_types(self):
self.assert_passes(
| Max Rule Not Working for Numeric String
My rule is this
rules = {
'card_number': ['bail', 'required', 'string', 'max:20'],
'card_expiry_date': ['bail', 'required','string', 'max:8'],
'card_cvv': ['bail', 'required', 'string', 'max:8']
}
I am passing the values
card_number = "876545666"
card_expiry_Date="0234"
card_cvv="123"
but this show error max value must be 20.
How can we validate that the string characters max:20 for value "8777745434" | 0.0 | 6ac6e87aedad48be2eddb5473321336efa0e02fa | [
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_max"
]
| [
"tests/test_rules_processor.py::TestRulesProcessor::test_allows_nullable_fields",
"tests/test_rules_processor.py::TestRulesProcessor::test_assert_params_size",
"tests/test_rules_processor.py::TestRulesProcessor::test_compare_dates",
"tests/test_rules_processor.py::TestRulesProcessor::test_custom_handlers",
"tests/test_rules_processor.py::TestRulesProcessor::test_get_rule_handler",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_accepted",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_active_url",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_after",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_after_or_equal",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha_dash",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_alpha_num",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_array",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_before",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_before_or_equal",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_between",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_boolean",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_confirmed",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_date",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_date_equals",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_different",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_digits",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_digits_between",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_dimensions",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_distinct",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_email",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_exists",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_extension",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_file",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_filled",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_gt",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_gte",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_image",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_in",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_in_array",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_integer",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ip",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ipv4",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_ipv6",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_json",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_lt",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_lte",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_mime_types",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_min",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_not_in",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_not_regex",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_numeric",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_present",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_regex",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_if",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_multiple_required_withouts",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_unless",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_with",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_with_all",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_without",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_required_without_all",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_same",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_size",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_sometimes",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_starts_with",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_string",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_timezone",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_unique",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_url",
"tests/test_rules_processor.py::TestRulesProcessor::test_validates_uuid"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2021-05-27 00:43:05+00:00 | mit | 1,630 |
|
codingjoe__django-stdimage-293 | diff --git a/stdimage/models.py b/stdimage/models.py
index bed00d7..6e0083d 100644
--- a/stdimage/models.py
+++ b/stdimage/models.py
@@ -264,6 +264,9 @@ class StdImageField(ImageField):
super().__init__(verbose_name=verbose_name, name=name, **kwargs)
+ # The attribute name of the old file to use on the model object
+ self._old_attname = "_old_%s" % name
+
def add_variation(self, name, params):
variation = self.def_variation.copy()
variation["kwargs"] = {}
@@ -313,9 +316,19 @@ class StdImageField(ImageField):
if self.delete_orphans and (data is False or data is not None):
file = getattr(instance, self.name)
if file and file._committed and file != data:
- file.delete(save=False)
+ # Store the old file which should be deleted if the new one is valid
+ setattr(instance, self._old_attname, file)
super().save_form_data(instance, data)
+ def pre_save(self, model_instance, add):
+ if hasattr(model_instance, self._old_attname):
+ # Delete the old file and its variations from the storage
+ old_file = getattr(model_instance, self._old_attname)
+ old_file.delete_variations()
+ old_file.storage.delete(old_file.name)
+ delattr(model_instance, self._old_attname)
+ return super().pre_save(model_instance, add)
+
def deconstruct(self):
name, path, args, kwargs = super().deconstruct()
return (
| codingjoe/django-stdimage | 0c5b5e58e966e125d5c35d8fb2199983a94cdc10 | diff --git a/tests/forms.py b/tests/forms.py
index c70347d..ff3927f 100644
--- a/tests/forms.py
+++ b/tests/forms.py
@@ -7,3 +7,9 @@ class ThumbnailModelForm(forms.ModelForm):
class Meta:
model = models.ThumbnailModel
fields = "__all__"
+
+
+class MinSizeModelForm(forms.ModelForm):
+ class Meta:
+ model = models.MinSizeModel
+ fields = "__all__"
diff --git a/tests/models.py b/tests/models.py
index 68a702f..4e91627 100644
--- a/tests/models.py
+++ b/tests/models.py
@@ -95,7 +95,11 @@ class MaxSizeModel(models.Model):
class MinSizeModel(models.Model):
- image = StdImageField(upload_to=upload_to, validators=[MinSizeValidator(200, 200)])
+ image = StdImageField(
+ upload_to=upload_to,
+ delete_orphans=True,
+ validators=[MinSizeValidator(200, 200)],
+ )
class ForceMinSizeModel(models.Model):
diff --git a/tests/test_forms.py b/tests/test_forms.py
index 81b3360..03629b0 100644
--- a/tests/test_forms.py
+++ b/tests/test_forms.py
@@ -45,3 +45,16 @@ class TestStdImageField(TestStdImage):
obj = form.save()
assert obj.image
assert os.path.exists(org_path)
+
+ def test_save_form_data__invalid(self, db):
+ instance = models.MinSizeModel.objects.create(
+ image=self.fixtures["600x400.jpg"]
+ )
+ org_path = instance.image.path
+ assert os.path.exists(org_path)
+ form = forms.MinSizeModelForm(
+ files={"image": self.fixtures["100.gif"]},
+ instance=instance,
+ )
+ assert not form.is_valid()
+ assert os.path.exists(org_path)
| Delete orphans is executing before validation
`save_form_data` with delete orphans is executing before `validate` which means that orphans are deleted even if image validation fails. Outcome is that database still holds the old file name while the file is deleted.
```python
# model
class ImageSample(models.Model):
image = StdImageField(
'main image',
delete_orphans=True,
blank=True,
validators=[
MinSizeValidator(500, 500),
],
help_text=_('Min image size is 500x500px.'),
)
# form
class SampleForm(forms.ModelForm):
class Meta:
model = ImageSample
fields = ['image']
```
1. Upload valid image (i.e. https://via.placeholder.com/600x600 ) - all is good
2. Now try to upload too small image (i.e. https://via.placeholder.com/200x200 ) - old file is deleted, validation kicks in, database still holds old file name
--
Tested on:
Django v2.2.19
django-stdimage v5.2.0, v5.2.1, v5.3.0
| 0.0 | 0c5b5e58e966e125d5c35d8fb2199983a94cdc10 | [
"tests/test_forms.py::TestStdImageField::test_save_form_data__invalid"
]
| [
"tests/test_forms.py::TestStdImageField::test_save_form_data__new",
"tests/test_forms.py::TestStdImageField::test_save_form_data__false",
"tests/test_forms.py::TestStdImageField::test_save_form_data__none"
]
| {
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-05-12 12:58:05+00:00 | mit | 1,631 |
|
codingjoe__joeflow-27 | diff --git a/.bandit b/.bandit
index fba0d25..b7df176 100644
--- a/.bandit
+++ b/.bandit
@@ -1,2 +1,2 @@
[bandit]
-exclude: tests
+exclude: ./tests
diff --git a/joeflow/models.py b/joeflow/models.py
index df067fa..266091f 100644
--- a/joeflow/models.py
+++ b/joeflow/models.py
@@ -137,7 +137,7 @@ class Workflow(models.Model, metaclass=WorkflowBase):
if isinstance(node, BaseCreateView):
route = "{name}/".format(name=name)
else:
- route = "{name}/<pk>/".format(name=name)
+ route = "{name}/<int:pk>/".format(name=name)
urls.append(
path(
route + node.path,
@@ -147,12 +147,12 @@ class Workflow(models.Model, metaclass=WorkflowBase):
)
if cls.detail_view:
urls.append(
- path("<pk>/", cls.detail_view.as_view(model=cls), name="detail")
+ path("<int:pk>/", cls.detail_view.as_view(model=cls), name="detail")
)
if cls.override_view:
urls.append(
path(
- "<pk>/override",
+ "<int:pk>/override",
cls.override_view.as_view(model=cls),
name="override",
)
| codingjoe/joeflow | 25fd79a750da7f346e81c8d80f1a35a65b0562f4 | diff --git a/tests/test_models.py b/tests/test_models.py
index dc82286..4ecad08 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -249,6 +249,10 @@ class TestWorkflow:
"override",
}
+ def test_urls__none_int_pk_mismatch(self, client):
+ response = client.get("/shipment/test/")
+ assert response.status_code == 404
+
class TestTaskQuerySet:
def test_scheduled(self, db):
| ValueError: Field 'id' expected a number but got a string
The following error occurs if someone tries to access a URL workflow detail view with a non integer primary key in the URL.
We should adjust the URL pattern to only accept integers to avoid this error and raise the expected 404 response.
```
ValueError: invalid literal for int() with base 10: 'some-string'
File "django/db/models/fields/__init__.py", line 1774, in get_prep_value
return int(value)
ValueError: Field 'id' expected a number but got 'some-string'.
File "django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "newrelic/hooks/framework_django.py", line 554, in wrapper
return wrapped(*args, **kwargs)
File "django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "newrelic/hooks/framework_django.py", line 944, in wrapper
return wrapped(*args, **kwargs)
File "django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "django/views/generic/detail.py", line 106, in get
self.object = self.get_object()
File "django/views/generic/detail.py", line 36, in get_object
queryset = queryset.filter(pk=pk)
File "django/db/models/query.py", line 942, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "django/db/models/query.py", line 962, in _filter_or_exclude
clone._filter_or_exclude_inplace(negate, *args, **kwargs)
File "django/db/models/query.py", line 969, in _filter_or_exclude_inplace
self._query.add_q(Q(*args, **kwargs))
File "django/db/models/sql/query.py", line 1358, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "django/db/models/sql/query.py", line 1377, in _add_q
child_clause, needed_inner = self.build_filter(
File "django/db/models/sql/query.py", line 1319, in build_filter
condition = self.build_lookup(lookups, col, value)
File "django/db/models/sql/query.py", line 1165, in build_lookup
lookup = lookup_class(lhs, rhs)
File "django/db/models/lookups.py", line 24, in __init__
self.rhs = self.get_prep_lookup()
File "django/db/models/fields/related_lookups.py", line 117, in get_prep_lookup
self.rhs = target_field.get_prep_value(self.rhs)
File "django/db/models/fields/__init__.py", line 1776, in get_prep_value
raise e.__class__(
``` | 0.0 | 25fd79a750da7f346e81c8d80f1a35a65b0562f4 | [
"tests/test_models.py::TestWorkflow::test_urls__none_int_pk_mismatch"
]
| [
"tests/test_models.py::TestWorkflow::test_get_absolute_url",
"tests/test_models.py::TestWorkflow::test_get_override_url",
"tests/test_models.py::TestWorkflow::test_cancel",
"tests/test_models.py::TestWorkflow::test_cancel__with_user",
"tests/test_models.py::TestWorkflow::test_cancel__with_anonymous_user",
"tests/test_models.py::TestTaskQuerySet::test_scheduled",
"tests/test_models.py::TestTaskQuerySet::test_succeeded",
"tests/test_models.py::TestTaskQuerySet::test_not_succeeded",
"tests/test_models.py::TestTaskQuerySet::test_failed",
"tests/test_models.py::TestTaskQuerySet::test_canceled",
"tests/test_models.py::TestTaskQuerySet::test_cancel__with_user",
"tests/test_models.py::TestTaskQuerySet::test_cancel__with_anonymous_user",
"tests/test_models.py::TestTask::test_start_next_tasks__default",
"tests/test_models.py::TestTask::test_start_next_tasks__specific_next_task",
"tests/test_models.py::TestTask::test_start_next_tasks__multiple_next_tasks",
"tests/test_models.py::TestTask::test_start_next_tasks__custom_task_creation",
"tests/test_models.py::TestTask::test_fail",
"tests/test_models.py::TestTask::test_cancel",
"tests/test_models.py::TestTask::test_cancel__with_user",
"tests/test_models.py::TestTask::test_cancel__with_anonymous_user",
"tests/test_models.py::TestTask::test_save__modified_date",
"tests/test_models.py::TestTask::test_save__no_update_fields",
"tests/test_models.py::TestWorkflowBase::test_name",
"tests/test_models.py::TestWorkflowBase::test_type",
"tests/test_models.py::TestWorkflowBase::test_workflow_cls",
"tests/test_models.py::TestWorkflow::test_get_nodes",
"tests/test_models.py::TestWorkflow::test_get_node",
"tests/test_models.py::TestWorkflow::test_get_next_nodes",
"tests/test_models.py::TestWorkflow::test_urls",
"tests/test_models.py::TestWorkflow::test_urls__custom_path",
"tests/test_models.py::TestWorkflow::test_urls__no_override",
"tests/test_models.py::TestWorkflow::test_urls__no_detail"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-01-08 09:33:31+00:00 | bsd-3-clause | 1,632 |
|
codingjoe__relint-11 | diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 8277382..e030a5a 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,1 +1,2 @@
+github: codingjoe
custom: https://www.paypal.me/codingjoe
diff --git a/.relint.yml b/.relint.yml
index 779fcee..5e508a6 100644
--- a/.relint.yml
+++ b/.relint.yml
@@ -1,7 +1,5 @@
- name: No ToDo
- pattern: "[tT][oO][dD][oO]"
+ pattern: '[tT][oO][dD][oO]'
hint: Get it done right away!
- filename:
- - "*.py"
- - "*.js"
+ filePattern: ^(?!.*test_).*\.(py|js)$
error: false
diff --git a/README.rst b/README.rst
index b434d28..60998da 100644
--- a/README.rst
+++ b/README.rst
@@ -20,11 +20,9 @@ You can write your own regular rules in a YAML file, like so:
.. code-block:: YAML
- name: No ToDo
- pattern: "[tT][oO][dD][oO]"
+ pattern: '[tT][oO][dD][oO]'
hint: Get it done right away!
- filename:
- - "*.py"
- - "*.js"
+ filePattern: .*\.(py|js)
error: false
The ``name`` attribute is the name of your linter, the ``pattern`` can be
@@ -32,7 +30,7 @@ any regular expression. The linter does lint entire files, therefore your
expressions can match multiple lines and include newlines.
You can narrow down the file types your linter should be working with, by
-providing the optional ``filename`` attribute. The default is ``*``.
+providing the optional ``filePattern`` attribute. The default is ``.*``.
The optional `error` attribute allows you to only show a warning but not exit
with a bad (non-zero) exit code. The default is `true`.
@@ -56,10 +54,10 @@ If you prefer linting changed files (cached on git) you can use the option
This option is useful for pre-commit purposes. Here an example of how to use it
with `pre-commit`_ framework:
-.. code-block:: YAML
+.. code-block:: yaml
- repo: https://github.com/codingjoe/relint
- rev: 0.5.0
+ rev: 1.2.0
hooks:
- id: relint
@@ -71,30 +69,24 @@ Samples
.. code-block:: yaml
- name: db fixtures
- pattern: "def test_[^(]+\\([^)]*(customer|product)(, |\\))"
+ pattern: 'def test_[^(]+\([^)]*(customer|product)(, |\))'
hint: Use model_mommy recipies instead of db fixtures.
- filename:
- - "**/test_*.py"
+ filePattern: test_.*\.py
- name: model_mommy recipies
- pattern: "mommy\\.make\\("
+ pattern: mommy\.make\(
hint: Please use mommy.make_recipe instead of mommy.make.
- filename:
- - "**/test_*.py"
- - "conftest.py"
- - "**/conftest.py"
+ filePattern: (test_.*|conftest)\.py
- name: the database is lava
- pattern: "@pytest.fixture.*\\n[ ]*def [^(]+\\([^)]*(db|transactional_db)(, |\\))"
+ pattern: '@pytest.fixture.*\n[ ]*def [^(]+\([^)]*(db|transactional_db)(, |\))'
hint: Please do not create db fixtures but model_mommy recipies instead.
- filename:
- - "*.py"
+ filePattern: .*\.py
- name: No logger in management commands
- pattern: "(logger|import logging)"
- hint: "Please write to self.stdout or self.stderr in favor of using a logger."
- filename:
- - "*/management/commands/*.py"
+ pattern: (logger|import logging)
+ hint: Please write to self.stdout or self.stderr in favor of using a logger.
+ filePattern: \/management\/commands\/.*\.py
.. _`pre-commit`: https://pre-commit.com/
.. _`relint-pre-commit.sh`: relint-pre-commit.sh
diff --git a/relint.py b/relint.py
index 0000d71..6764264 100644
--- a/relint.py
+++ b/relint.py
@@ -3,6 +3,7 @@ import fnmatch
import glob
import re
import sys
+import warnings
from collections import namedtuple
from itertools import chain
@@ -16,10 +17,19 @@ GIT_DIFF_SPLIT_PATTERN = re.compile(
r"(?:\n|^)diff --git a\/.* b\/.*(?:\n|$)")
-Test = namedtuple('Test', ('name', 'pattern', 'hint', 'filename', 'error'))
+Test = namedtuple(
+ 'Test', (
+ 'name',
+ 'pattern',
+ 'hint',
+ 'file_pattern',
+ 'filename',
+ 'error',
+ )
+)
-def parse_args():
+def parse_args(args):
parser = argparse.ArgumentParser()
parser.add_argument(
'files',
@@ -42,19 +52,29 @@ def parse_args():
action='store_true',
help='Analyze content from git diff.'
)
- return parser.parse_args()
+ return parser.parse_args(args=args)
def load_config(path):
with open(path) as fs:
for test in yaml.safe_load(fs):
- filename = test.get('filename', ['*'])
- if not isinstance(filename, list):
- filename = list(filename)
+ filename = test.get('filename')
+ if filename:
+ warnings.warn(
+ "The glob style 'filename' configuration attribute has been"
+ " deprecated in favor of a new RegEx based 'filePattern' attribute."
+ " 'filename' support will be removed in relint version 2.0.",
+ DeprecationWarning
+ )
+ if not isinstance(filename, list):
+ filename = list(filename)
+ file_pattern = test.get('filePattern', '.*')
+ file_pattern = re.compile(file_pattern)
yield Test(
name=test['name'],
pattern=re.compile(test['pattern'], re.MULTILINE),
hint=test.get('hint'),
+ file_pattern=file_pattern,
filename=filename,
error=test.get('error', True)
)
@@ -68,10 +88,16 @@ def lint_file(filename, tests):
pass
else:
for test in tests:
- if any(fnmatch.fnmatch(filename, fp) for fp in test.filename):
- for match in test.pattern.finditer(content):
- line_number = match.string[:match.start()].count('\n') + 1
- yield filename, test, match, line_number
+ if test.filename:
+ if any(fnmatch.fnmatch(filename, fp) for fp in test.filename):
+ for match in test.pattern.finditer(content):
+ line_number = match.string[:match.start()].count('\n') + 1
+ yield filename, test, match, line_number
+ else:
+ if test.file_pattern.match(filename):
+ for match in test.pattern.finditer(content):
+ line_number = match.string[:match.start()].count('\n') + 1
+ yield filename, test, match, line_number
def parse_line_numbers(output):
@@ -183,8 +209,8 @@ def parse_diff(output):
return changed_content
-def main():
- args = parse_args()
+def main(args=sys.argv):
+ args = parse_args(args)
paths = {
path
for file in args.files
@@ -207,5 +233,9 @@ def main():
exit(exit_code)
+if not sys.warnoptions:
+ warnings.simplefilter('default')
+
+
if __name__ == '__main__':
main()
| codingjoe/relint | 01f4cc0a3a3f660e663c35477ef9cec6846682eb | diff --git a/test_relint.py b/test_relint.py
index 524dd68..a7b5f12 100644
--- a/test_relint.py
+++ b/test_relint.py
@@ -1,5 +1,6 @@
import io
import sys
+import warnings
import pytest
@@ -10,10 +11,8 @@ from relint import (main, match_with_diff_changes, parse_diff, parse_filenames,
class TestMain:
@pytest.mark.parametrize('filename', ['test_relint.py', '[a-b].py', '[b-a].py'])
def test_main_execution(self, mocker, filename):
- mocker.patch.object(sys, 'argv', ['relint.py', filename])
-
with pytest.raises(SystemExit) as exc_info:
- main()
+ main(['relint.py', filename])
assert exc_info.value.code == 0
@@ -26,12 +25,11 @@ class TestMain:
"+# TODO do something"
)
- mocker.patch.object(sys, 'argv', ['relint.py', 'dummy.py', '--diff'])
mocker.patch.object(sys, 'stdin', diff)
with tmpdir.as_cwd():
with pytest.raises(SystemExit) as exc_info:
- main()
+ main(['relint.py', 'dummy.py', '--diff'])
expected_message = 'Hint: Get it done right away!'
@@ -144,3 +142,19 @@ class TestParseGitDiff:
expected = {'test_relint.py': [2]}
assert parsed_content == expected
+
+ def test_filename_warning(self, tmpdir):
+ tmpdir.join('.relint.yml').write(
+ '- name: old\n'
+ ' pattern: ".*"\n'
+ ' filename: "*.py"\n'
+ )
+
+ with tmpdir.as_cwd():
+ with warnings.catch_warnings(record=True) as w:
+ with pytest.raises(SystemExit) as exc_info:
+ main(['**'])
+
+ assert exc_info.value.code == 0
+ assert issubclass(w[-1].category, DeprecationWarning)
+ assert "'filename'" in str(w[-1].message)
| Exclude specific files that would otherwise match a broader pattern
I work on a python repository and I'd like to use relint in pre-commit and CI pipeline to make sure nobody ever commits a `print` call, so I use this pattern specification:
```yaml
- name: Leftover print
pattern: "print\\("
filename:
- "*.py"
```
However, there is one file in the root of the repo - `run.py` which contains a few startup scripts and it uses prints to give some runtime info to the users.
Is there any way I can define the `filename` pattern in a way to include all `.py` files _except_ `run.py`? | 0.0 | 01f4cc0a3a3f660e663c35477ef9cec6846682eb | [
"test_relint.py::TestMain::test_main_execution[test_relint.py]",
"test_relint.py::TestMain::test_main_execution[[a-b].py]",
"test_relint.py::TestMain::test_main_execution[[b-a].py]",
"test_relint.py::TestMain::test_main_execution_with_diff"
]
| [
"test_relint.py::TestParseGitDiff::test_line_numbers",
"test_relint.py::TestParseGitDiff::test_line_numbers_when_only_one_line_was_changed",
"test_relint.py::TestParseGitDiff::test_parse_filenames[diff",
"test_relint.py::TestParseGitDiff::test_split_diff_content",
"test_relint.py::TestParseGitDiff::test_return_empty_list_if_can_not_split_diff_content",
"test_relint.py::TestParseGitDiff::test_return_empty_dict_when_diff_returns_empty",
"test_relint.py::TestParseGitDiff::test_match_with_diff_changes",
"test_relint.py::TestParseGitDiff::test_parse_one_line_changed_one_file",
"test_relint.py::TestParseGitDiff::test_parse_multiple_line_changed_one_file",
"test_relint.py::TestParseGitDiff::test_parse_complete_diff"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2019-10-25 03:54:41+00:00 | mit | 1,633 |
|
codingjoe__relint-25 | diff --git a/relint.py b/relint.py
index f22aeeb..ba2ffd5 100644
--- a/relint.py
+++ b/relint.py
@@ -17,6 +17,14 @@ GIT_DIFF_SPLIT_PATTERN = re.compile(
r"(?:\n|^)diff --git a\/.* b\/.*(?:\n|$)")
+class RelintError(Exception):
+ pass
+
+
+class ConfigError(ValueError, RelintError):
+ pass
+
+
Test = namedtuple(
'Test', (
'name',
@@ -63,27 +71,36 @@ def parse_args(args):
def load_config(path, fail_warnings):
with open(path) as fs:
- for test in yaml.safe_load(fs):
- filename = test.get('filename')
- if filename:
- warnings.warn(
- "The glob style 'filename' configuration attribute has been"
- " deprecated in favor of a new RegEx based 'filePattern' attribute."
- " 'filename' support will be removed in relint version 2.0.",
- DeprecationWarning
+ try:
+ for test in yaml.safe_load(fs):
+ filename = test.get('filename')
+ if filename:
+ warnings.warn(
+ "The glob style 'filename' configuration attribute has been"
+ " deprecated in favor of a new RegEx based 'filePattern' attribute."
+ " 'filename' support will be removed in relint version 2.0.",
+ DeprecationWarning
+ )
+ if not isinstance(filename, list):
+ filename = list(filename)
+ file_pattern = test.get('filePattern', '.*')
+ file_pattern = re.compile(file_pattern)
+ yield Test(
+ name=test['name'],
+ pattern=re.compile(test['pattern'], re.MULTILINE),
+ hint=test.get('hint'),
+ file_pattern=file_pattern,
+ filename=filename,
+ error=test.get('error', True) or fail_warnings
)
- if not isinstance(filename, list):
- filename = list(filename)
- file_pattern = test.get('filePattern', '.*')
- file_pattern = re.compile(file_pattern)
- yield Test(
- name=test['name'],
- pattern=re.compile(test['pattern'], re.MULTILINE),
- hint=test.get('hint'),
- file_pattern=file_pattern,
- filename=filename,
- error=test.get('error', True) or fail_warnings
- )
+ except yaml.YAMLError as e:
+ raise ConfigError("Error parsing your relint config file.") from e
+ except TypeError:
+ warnings.warn("Your relint config is empty, no tests were executed.", UserWarning)
+ except (AttributeError, ValueError) as e:
+ raise ConfigError(
+ "Your relint config is not a valid YAML list of relint tests."
+ ) from e
def lint_file(filename, tests):
| codingjoe/relint | 468ebc574285658e0517bf3dc2cd53dd2502b27f | diff --git a/test_relint.py b/test_relint.py
index 36f67bf..fe8f190 100644
--- a/test_relint.py
+++ b/test_relint.py
@@ -3,9 +3,10 @@ import sys
import warnings
import pytest
+import yaml
from relint import (main, match_with_diff_changes, parse_diff, parse_filenames,
- parse_line_numbers, split_diff_content_by_filename,)
+ parse_line_numbers, split_diff_content_by_filename, ConfigError, )
class TestMain:
@@ -165,3 +166,33 @@ class TestParseGitDiff:
assert exc_info.value.code == 0
assert issubclass(w[-1].category, DeprecationWarning)
assert "'filename'" in str(w[-1].message)
+
+ def test_empty_config_file(self, tmpdir):
+ tmpdir.join('.relint.yml').write('')
+
+ with tmpdir.as_cwd():
+ with warnings.catch_warnings(record=True) as w:
+ with pytest.raises(SystemExit) as exc_info:
+ main(['**'])
+
+ assert exc_info.value.code == 0
+ assert issubclass(w[-1].category, UserWarning)
+ assert "Your relint config is empty, no tests were executed." in str(w[-1].message)
+
+ def test_malformed_config_file(self, tmpdir):
+ tmpdir.join('.relint.yml').write('test:')
+
+ with tmpdir.as_cwd():
+ with pytest.raises(ConfigError) as exc_info:
+ main(['**'])
+
+ assert "Your relint config is not a valid YAML list of relint tests." in str(exc_info.value)
+
+ def test_corrupt_config_file(self, tmpdir):
+ tmpdir.join('.relint.yml').write(b'\x00')
+
+ with tmpdir.as_cwd():
+ with pytest.raises(ConfigError) as exc_info:
+ main(['**'])
+
+ assert 'Error parsing your relint config file.' in str(exc_info.value)
| Crash on empty configuration
```
Traceback (most recent call last):
File "/path/bin/relint", line 8, in <module>
sys.exit(main())
File "/path/lib/python3.8/site-packages/relint.py", line 220, in main
tests = list(load_config(args.config))
File "/path/lib/python3.8/site-packages/relint.py", line 60, in load_config
for test in yaml.safe_load(fs):
TypeError: 'NoneType' object is not iterable
```
Reproduction:
- create an empty file relint.yaml
- run with relint -c relint.yaml | 0.0 | 468ebc574285658e0517bf3dc2cd53dd2502b27f | [
"test_relint.py::TestMain::test_main_execution[test_relint.py]",
"test_relint.py::TestMain::test_main_execution[[a-b].py]",
"test_relint.py::TestMain::test_main_execution[[b-a].py]",
"test_relint.py::TestMain::test_main_execution_with_diff",
"test_relint.py::TestParseGitDiff::test_line_numbers",
"test_relint.py::TestParseGitDiff::test_line_numbers_when_only_one_line_was_changed",
"test_relint.py::TestParseGitDiff::test_parse_filenames[diff",
"test_relint.py::TestParseGitDiff::test_split_diff_content",
"test_relint.py::TestParseGitDiff::test_return_empty_list_if_can_not_split_diff_content",
"test_relint.py::TestParseGitDiff::test_return_empty_dict_when_diff_returns_empty",
"test_relint.py::TestParseGitDiff::test_match_with_diff_changes",
"test_relint.py::TestParseGitDiff::test_parse_one_line_changed_one_file",
"test_relint.py::TestParseGitDiff::test_parse_multiple_line_changed_one_file",
"test_relint.py::TestParseGitDiff::test_parse_complete_diff",
"test_relint.py::TestParseGitDiff::test_empty_config_file",
"test_relint.py::TestParseGitDiff::test_malformed_config_file",
"test_relint.py::TestParseGitDiff::test_corrupt_config_file"
]
| []
| {
"failed_lite_validators": [
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2022-08-03 08:52:25+00:00 | mit | 1,634 |
|
cogeotiff__rio-cogeo-44 | diff --git a/CHANGES.txt b/CHANGES.txt
index 5c30828..99752e8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,12 @@
+Next release
+------------
+- Renamed "ycbcr" profile's name to "jpeg" to reflect the compression name.
+ "ycbcr" profile will raise a "DeprecationWarning" (#44)
+- "webp" profile has been added to COG profiles. Exploitation of this new
+ compression mode will require GDAL 2.4 (#27)
+- Rio-cogeo can calculate the overview level based on the internal tile size
+ and the dataset width/height (#37)
+
1.0dev8 (2018-10-02)
--------------------
- write tags in output file (#31)
diff --git a/README.rst b/README.rst
index be79c05..b24078f 100644
--- a/README.rst
+++ b/README.rst
@@ -43,11 +43,13 @@ Usage
Options:
-b, --bidx BIDX Band index to copy
- -p, --cog-profile [ycbcr|zstd|lzw|deflate|packbits|raw]
- CloudOptimized GeoTIFF profile (default: ycbcr)
+ -p, --cog-profile [ycbcr|jpeg|webp|zstd|lzw|deflate|packbits|raw]
+ CloudOptimized GeoTIFF profile (default: jpeg)
--nodata INTEGER Force mask creation from a given nodata value
--alpha INTEGER Force mask creation from a given alpha band number
- --overview-level INTEGER Overview level (default: 6)
+ --overview-level INTEGER Overview level
+ (if not provided, appropriate overview level will be selected until the
+ smallest overview is smaller than the internal block size)
--overview-resampling [nearest|bilinear|cubic|cubic_spline|lanczos|average|mode|gauss] Resampling algorithm.
--threads INTEGER
--co, --profile NAME=VALUE Driver specific creation options.See the
@@ -60,8 +62,8 @@ Examples
.. code-block:: console
- # Create a COGEO with YCbCR profile and the first 3 bands of the data
- $ rio cogeo mydataset.tif mydataset_ycbcr.tif -b 1,2,3
+ # Create a COGEO with JPEG profile and the first 3 bands of the data
+ $ rio cogeo mydataset.tif mydataset_jpeg.tif -b 1,2,3
# Create a COGEO without compression and with 1024x1024 block size
$ rio cogeo mydataset.tif mydataset_raw.tif --co BLOCKXSIZE=1024 --co BLOCKYSIZE=1024 --cog-profile raw
@@ -71,7 +73,14 @@ Default COGEO profiles
Profiles can be extended by providing '--co' option in command line (e.g: rio cogeo mydataset.tif mydataset_zstd.tif -b 1,2,3 --profile deflate --co "COMPRESS=ZSTD" )
-**YCbCr**
+**YCbCr** *DEPRECATED in 1.0*
+
+- JPEG compression
+- PIXEL interleave
+- YCbCr colorspace
+- limited to uint8 datatype and 3 bands data
+
+**JPEG**
- JPEG compression
- PIXEL interleave
@@ -115,8 +124,10 @@ Profiles can be extended by providing '--co' option in command line (e.g: rio co
Default profiles are tiled with 512x512 blocksizes.
-Contribution & Devellopement
-============================
+Contribution & Development
+==========================
+
+The rio-cogeo project was begun at Mapbox and has been transferred in January 2019.
Issues and pull requests are more than welcome.
diff --git a/rio_cogeo/errors.py b/rio_cogeo/errors.py
new file mode 100644
index 0000000..f0da547
--- /dev/null
+++ b/rio_cogeo/errors.py
@@ -0,0 +1,5 @@
+"""Rio-Cogeo Errors and Warnings."""
+
+
+class DeprecationWarning(UserWarning):
+ """Rio-cogeo module deprecations warning."""
diff --git a/rio_cogeo/profiles.py b/rio_cogeo/profiles.py
index cf9e9b4..02a4e03 100644
--- a/rio_cogeo/profiles.py
+++ b/rio_cogeo/profiles.py
@@ -1,5 +1,7 @@
"""rio_cogeo.profiles: CloudOptimized profiles."""
+import warnings
+from rio_cogeo.errors import DeprecationWarning
from rasterio.profiles import Profile
@@ -17,6 +19,20 @@ class YCbCrProfile(Profile):
}
+class JPEGProfile(Profile):
+ """Tiled, pixel-interleaved, JPEG-compressed, YCbCr colorspace, 8-bit GTiff."""
+
+ defaults = {
+ "driver": "GTiff",
+ "interleave": "pixel",
+ "tiled": True,
+ "blockxsize": 512,
+ "blockysize": 512,
+ "compress": "JPEG",
+ "photometric": "YCbCr",
+ }
+
+
class WEBPProfile(Profile):
"""Tiled, pixel-interleaved, WEBP-compressed, 8-bit GTiff."""
@@ -105,6 +121,7 @@ class COGProfiles(dict):
self.update(
{
"ycbcr": YCbCrProfile(),
+ "jpeg": JPEGProfile(),
"webp": WEBPProfile(),
"zstd": ZSTDProfile(),
"lzw": LZWProfile(),
@@ -116,6 +133,12 @@ class COGProfiles(dict):
def get(self, key):
"""Like normal item access but error."""
+ if key == "ycbcr":
+ warnings.warn(
+ "'ycbcr' profile will be removed in 1.0, use 'jpeg' instead",
+ DeprecationWarning,
+ )
+
if key not in (self.keys()):
raise KeyError("{} is not a valid COG profile name".format(key))
diff --git a/rio_cogeo/scripts/cli.py b/rio_cogeo/scripts/cli.py
index d0c3442..b2b56b8 100644
--- a/rio_cogeo/scripts/cli.py
+++ b/rio_cogeo/scripts/cli.py
@@ -43,8 +43,8 @@ class CustomType:
"-p",
"cogeo_profile",
type=click.Choice(cog_profiles.keys()),
- default="ycbcr",
- help="CloudOptimized GeoTIFF profile (default: ycbcr)",
+ default="jpeg",
+ help="CloudOptimized GeoTIFF profile (default: jpeg)",
)
@click.option(
"--nodata", type=int, help="Force mask creation from a given nodata value"
| cogeotiff/rio-cogeo | 0354d3aacc83eeb1be3beb78e293561183efb0b3 | diff --git a/tests/test_profile.py b/tests/test_profile.py
index 4926f81..6783e38 100644
--- a/tests/test_profile.py
+++ b/tests/test_profile.py
@@ -1,13 +1,25 @@
"""tests rio_cogeo.profiles."""
import pytest
-
+from rio_cogeo.errors import DeprecationWarning
from rio_cogeo.profiles import cog_profiles
def test_profiles_ycbcr():
- """Should work as expected (return ycbcr profile)."""
- profile = cog_profiles.get("ycbcr")
+ """Should work as expected (return ycbcr profile and raise warning)."""
+ with pytest.warns(DeprecationWarning):
+ profile = cog_profiles.get("ycbcr")
+ assert profile["tiled"]
+ assert profile["compress"] == "JPEG"
+ assert profile["blockxsize"] == 512
+ assert profile["blockysize"] == 512
+ assert profile["photometric"] == "YCbCr"
+ assert profile["interleave"] == "pixel"
+
+
+def test_profiles_jpeg():
+ """Should work as expected (return jpeg profile)."""
+ profile = cog_profiles.get("jpeg")
assert profile["tiled"]
assert profile["compress"] == "JPEG"
assert profile["blockxsize"] == 512
| Rename `YCbCR` profile to `JPEG`
https://github.com/mapbox/rio-cogeo/blob/dc48a99b23fa1c538cb8b81747c5217fc1f996b7/rio_cogeo/profiles.py#L6
I think using `jpeg` instead of `ycbcr` will make more sense for a profile name
cc @perrygeo @sgillies | 0.0 | 0354d3aacc83eeb1be3beb78e293561183efb0b3 | [
"tests/test_profile.py::test_profiles_ycbcr",
"tests/test_profile.py::test_profiles_jpeg",
"tests/test_profile.py::test_profiles_webp",
"tests/test_profile.py::test_profiles_lzw",
"tests/test_profile.py::test_profiles_deflate",
"tests/test_profile.py::test_profiles_packbits",
"tests/test_profile.py::test_profiles_raw",
"tests/test_profile.py::test_profiles_copy",
"tests/test_profile.py::test_profiles_error"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2018-11-29 14:56:08+00:00 | bsd-3-clause | 1,635 |
|
cogeotiff__rio-cogeo-65 | diff --git a/CHANGES.txt b/CHANGES.txt
index bce8d83..34319c4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,12 @@
+1.0b1 (2019-03-25)
+------------------
+
+Breacking Changes:
+
+- refactor utils.get_maximum_overview_level to get rasterio dataset
+as input and reduce the number of dataset opennings (#61)
+
+
1.0b0 (2019-03-15)
------------------
- add more logging and `--quiet` option (#46)
diff --git a/rio_cogeo/__init__.py b/rio_cogeo/__init__.py
index d3a8d9f..798dca7 100644
--- a/rio_cogeo/__init__.py
+++ b/rio_cogeo/__init__.py
@@ -1,3 +1,3 @@
"""rio_cogeo"""
-__version__ = "1.0b0"
+__version__ = "1.0b1"
diff --git a/rio_cogeo/cogeo.py b/rio_cogeo/cogeo.py
index e14e52a..6339a8d 100644
--- a/rio_cogeo/cogeo.py
+++ b/rio_cogeo/cogeo.py
@@ -59,11 +59,6 @@ def cog_translate(
"""
config = config or {}
- if overview_level is None:
- overview_level = get_maximum_overview_level(
- src_path, min(int(dst_kwargs["blockxsize"]), int(dst_kwargs["blockysize"]))
- )
-
with rasterio.Env(**config):
with rasterio.open(src_path) as src_dst:
meta = src_dst.meta
@@ -82,6 +77,12 @@ def cog_translate(
LossyCompression,
)
+ if overview_level is None:
+ overview_level = get_maximum_overview_level(
+ src_dst,
+ min(int(dst_kwargs["blockxsize"]), int(dst_kwargs["blockysize"])),
+ )
+
vrt_params = dict(add_alpha=True)
if nodata is not None:
diff --git a/rio_cogeo/utils.py b/rio_cogeo/utils.py
index 44edb90..19eed74 100644
--- a/rio_cogeo/utils.py
+++ b/rio_cogeo/utils.py
@@ -1,14 +1,27 @@
"""rio_cogeo.utils: Utility functions."""
-import rasterio
from rasterio.enums import MaskFlags, ColorInterp
-def get_maximum_overview_level(src_path, minsize=512):
- """Calculate the maximum overview level."""
- with rasterio.open(src_path) as src:
- width = src.width
- height = src.height
+def get_maximum_overview_level(src_dst, minsize=512):
+ """
+ Calculate the maximum overview level.
+
+ Attributes
+ ----------
+ src_dst : rasterio.io.DatasetReader
+ Rasterio io.DatasetReader object.
+ minsize : int (default: 512)
+ Minimum overview size.
+
+ Returns
+ -------
+ nlevel: int
+ overview level.
+
+ """
+ width = src_dst.width
+ height = src_dst.height
nlevel = 0
overview = 1
| cogeotiff/rio-cogeo | fb9ceba8b00dae22bce68b196c47a88a62371b61 | diff --git a/tests/test_utils.py b/tests/test_utils.py
index 98e5bbd..d1b076b 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -2,6 +2,7 @@
import os
+import rasterio
from rio_cogeo.utils import get_maximum_overview_level
raster_path_rgb = os.path.join(os.path.dirname(__file__), "fixtures", "image_rgb.tif")
@@ -9,4 +10,6 @@ raster_path_rgb = os.path.join(os.path.dirname(__file__), "fixtures", "image_rgb
def test_overviewlevel_valid():
"""Should work as expected (return overview level)."""
- assert get_maximum_overview_level(raster_path_rgb, 128) == 2
+ with rasterio.open(raster_path_rgb) as src_dst:
+ assert get_maximum_overview_level(src_dst, 128) == 2
+ assert get_maximum_overview_level(src_dst) == 0
| Update get_maximum_overview_level to use Rasterio dataset directly
in https://github.com/cogeotiff/rio-cogeo/blob/fb9ceba8b00dae22bce68b196c47a88a62371b61/rio_cogeo/cogeo.py#L62-L66
we pass the dataset path and then open it in `get_maximum_overview_level` function. This means we have to open the dataset twice while it's not really necessary | 0.0 | fb9ceba8b00dae22bce68b196c47a88a62371b61 | [
"tests/test_utils.py::test_overviewlevel_valid"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-03-25 13:49:12+00:00 | bsd-3-clause | 1,636 |
|
cogeotiff__rio-cogeo-92 | diff --git a/CHANGES.txt b/CHANGES.txt
index e40dabd..bf7a6c8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,16 @@
+1.1.1 (2019-09-10)
+------------------
+
+- add safeguard to keep datatype from input to output files (#85)
+
+CLI Changes:
+- add `-t, --dtype` datatype option.
+
+API Changes:
+- add datatype option
+- update for rasterio>=1.0.28
+- allow rasterio.io.DatasetReader input (#89)
+
1.1.0 (2019-07-16)
------------------
diff --git a/README.md b/README.md
index 5d5b5a9..f812c9a 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,8 @@ $ rio cogeo create --help
-p, --cog-profile [jpeg|webp|zstd|lzw|deflate|packbits|raw] CloudOptimized GeoTIFF profile (default: deflate).
--nodata NUMBER|nan Set nodata masking values for input dataset.
--add-mask Force output dataset creation with an internal mask (convert alpha band or nodata to mask).
+ -t, --dtype [ubyte|uint8|uint16|int16|uint32|int32|float32|float64]
+ Output data type.
--overview-level INTEGER Overview level (if not provided, appropriate overview level will be selected
until the smallest overview is smaller than the value of the internal blocksize)
--overview-resampling [nearest|bilinear|cubic|cubic_spline|lanczos|average|mode|gauss] Overview creation resampling algorithm.
diff --git a/requirements.txt b/requirements.txt
index df1980e..2e8aae4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,5 @@
click
numpy~=1.15
-rasterio>=1.0.9
+rasterio>=1.0.28
+supermercado
+mercantile
\ No newline at end of file
diff --git a/rio_cogeo/cogeo.py b/rio_cogeo/cogeo.py
index a41bf77..a560c58 100644
--- a/rio_cogeo/cogeo.py
+++ b/rio_cogeo/cogeo.py
@@ -10,7 +10,7 @@ from contextlib import contextmanager
import click
import rasterio
-from rasterio.io import MemoryFile
+from rasterio.io import DatasetReader, MemoryFile
from rasterio.env import GDALVersion
from rasterio.vrt import WarpedVRT
from rasterio.warp import transform_bounds
@@ -20,7 +20,6 @@ from rasterio.transform import Affine
import mercantile
from supermercado.burntiles import tile_extrema
-
from rio_cogeo.errors import LossyCompression, IncompatibleBlockRasterSize
from rio_cogeo.utils import (
get_maximum_overview_level,
@@ -52,11 +51,12 @@ def TemporaryRasterFile(dst_path, suffix=".tif"):
def cog_translate(
- src_path,
+ source,
dst_path,
dst_kwargs,
indexes=None,
nodata=None,
+ dtype=None,
add_mask=None,
overview_level=None,
overview_resampling="nearest",
@@ -72,8 +72,9 @@ def cog_translate(
Parameters
----------
- src_path : str or PathLike object
- A dataset path or URL. Will be opened in "r" mode.
+ source : str, PathLike object or rasterio.io.DatasetReader
+ A dataset path, URL or rasterio.io.DatasetReader object.
+ Will be opened in "r" mode.
dst_path : str or Path-like object
An output dataset path or or PathLike object.
Will be opened in "w" mode.
@@ -83,6 +84,8 @@ def cog_translate(
Raster band indexes to copy.
nodata, int, optional
Overwrite nodata masking values for input dataset.
+ dtype: str, optional
+ Overwrite output data type. Default will be the input data type.
add_mask, bool, optional
Force output dataset creation with a mask.
overview_level : int, optional (default: 6)
@@ -106,10 +109,16 @@ def cog_translate(
config = config or {}
with rasterio.Env(**config):
- with rasterio.open(src_path) as src_dst:
+ with ExitStack() as ctx:
+ if isinstance(source, DatasetReader):
+ src_dst = ctx.enter_context(source)
+ else:
+ src_dst = ctx.enter_context(rasterio.open(source))
+
meta = src_dst.meta
indexes = indexes if indexes else src_dst.indexes
nodata = nodata if nodata is not None else src_dst.nodata
+ dtype = dtype if dtype else src_dst.dtypes[0]
alpha = has_alpha_band(src_dst)
mask = has_mask_band(src_dst)
@@ -147,7 +156,7 @@ def cog_translate(
dst_kwargs["blockxsize"] = tilesize
dst_kwargs["blockysize"] = tilesize
- vrt_params = dict(add_alpha=True)
+ vrt_params = dict(add_alpha=True, dtype=dtype)
if nodata is not None:
vrt_params.update(
@@ -204,62 +213,59 @@ def cog_translate(
if in_memory is None:
in_memory = vrt_dst.width * vrt_dst.height < IN_MEMORY_THRESHOLD
- with ExitStack() as ctx:
- if in_memory:
- tmpfile = ctx.enter_context(MemoryFile())
- tmp_dst = ctx.enter_context(tmpfile.open(**meta))
- else:
- tmpfile = ctx.enter_context(TemporaryRasterFile(dst_path))
- tmp_dst = ctx.enter_context(
- rasterio.open(tmpfile.name, "w", **meta)
- )
+ if in_memory:
+ tmpfile = ctx.enter_context(MemoryFile())
+ tmp_dst = ctx.enter_context(tmpfile.open(**meta))
+ else:
+ tmpfile = ctx.enter_context(TemporaryRasterFile(dst_path))
+ tmp_dst = ctx.enter_context(
+ rasterio.open(tmpfile.name, "w", **meta)
+ )
- wind = list(tmp_dst.block_windows(1))
+ wind = list(tmp_dst.block_windows(1))
- if not quiet:
- click.echo("Reading input: {}".format(src_path), err=True)
- fout = os.devnull if quiet else sys.stderr
- with click.progressbar(
- wind, length=len(wind), file=fout, show_percent=True
- ) as windows:
- for ij, w in windows:
- matrix = vrt_dst.read(window=w, indexes=indexes)
- tmp_dst.write(matrix, window=w)
+ if not quiet:
+ click.echo("Reading input: {}".format(source), err=True)
+ fout = os.devnull if quiet else sys.stderr
+ with click.progressbar(
+ wind, length=len(wind), file=fout, show_percent=True
+ ) as windows:
+ for ij, w in windows:
+ matrix = vrt_dst.read(window=w, indexes=indexes)
+ tmp_dst.write(matrix, window=w)
- if add_mask or mask:
- mask_value = vrt_dst.dataset_mask(window=w)
- tmp_dst.write_mask(mask_value, window=w)
+ if add_mask or mask:
+ mask_value = vrt_dst.dataset_mask(window=w)
+ tmp_dst.write_mask(mask_value, window=w)
- if overview_level is None:
- overview_level = get_maximum_overview_level(vrt_dst, tilesize)
+ if overview_level is None:
+ overview_level = get_maximum_overview_level(vrt_dst, tilesize)
- if not quiet and overview_level:
- click.echo("Adding overviews...", err=True)
+ if not quiet and overview_level:
+ click.echo("Adding overviews...", err=True)
- overviews = [2 ** j for j in range(1, overview_level + 1)]
- tmp_dst.build_overviews(
- overviews, ResamplingEnums[overview_resampling]
- )
+ overviews = [2 ** j for j in range(1, overview_level + 1)]
+ tmp_dst.build_overviews(overviews, ResamplingEnums[overview_resampling])
- if not quiet:
- click.echo("Updating dataset tags...", err=True)
+ if not quiet:
+ click.echo("Updating dataset tags...", err=True)
- for i, b in enumerate(indexes):
- tmp_dst.set_band_description(i + 1, src_dst.descriptions[b - 1])
+ for i, b in enumerate(indexes):
+ tmp_dst.set_band_description(i + 1, src_dst.descriptions[b - 1])
- tags = src_dst.tags()
- tags.update(
- dict(
- OVR_RESAMPLING_ALG=ResamplingEnums[
- overview_resampling
- ].name.upper()
- )
+ tags = src_dst.tags()
+ tags.update(
+ dict(
+ OVR_RESAMPLING_ALG=ResamplingEnums[
+ overview_resampling
+ ].name.upper()
)
- tmp_dst.update_tags(**tags)
+ )
+ tmp_dst.update_tags(**tags)
- if not quiet:
- click.echo("Writing output to: {}".format(dst_path), err=True)
- copy(tmp_dst, dst_path, copy_src_overviews=True, **dst_kwargs)
+ if not quiet:
+ click.echo("Writing output to: {}".format(dst_path), err=True)
+ copy(tmp_dst, dst_path, copy_src_overviews=True, **dst_kwargs)
def cog_validate(src_path):
diff --git a/rio_cogeo/scripts/cli.py b/rio_cogeo/scripts/cli.py
index 7f73cbe..75c1034 100644
--- a/rio_cogeo/scripts/cli.py
+++ b/rio_cogeo/scripts/cli.py
@@ -84,6 +84,7 @@ def cogeo():
help="Force output dataset creation with an internal mask (convert alpha "
"band or nodata to mask).",
)
[email protected]_opt
@click.option(
"--overview-level",
type=int,
@@ -141,6 +142,7 @@ def create(
bidx,
cogeo_profile,
nodata,
+ dtype,
add_mask,
overview_level,
overview_resampling,
@@ -175,17 +177,18 @@ def create(
input,
output,
output_profile,
- bidx,
- nodata,
- add_mask,
- overview_level,
- overview_resampling,
- web_optimized,
- latitude_adjustment,
- resampling,
- in_memory,
- config,
- quiet,
+ indexes=bidx,
+ nodata=nodata,
+ dtype=dtype,
+ add_mask=add_mask,
+ overview_level=overview_level,
+ overview_resampling=overview_resampling,
+ web_optimized=web_optimized,
+ latitude_adjustment=latitude_adjustment,
+ resampling=resampling,
+ in_memory=in_memory,
+ config=config,
+ quiet=quiet,
)
diff --git a/setup.py b/setup.py
index bd2f07d..944254d 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@ with open("README.md") as f:
# Runtime requirements.
inst_reqs = [
"click",
- "rasterio[s3]>=1.0.1",
+ "rasterio[s3]>=1.0.28",
"numpy~=1.15",
"supermercado",
"mercantile",
@@ -29,7 +29,7 @@ if sys.version_info >= (3, 6):
setup(
name="rio-cogeo",
- version="1.1.0",
+ version="1.1.1",
description=u"CloudOptimized GeoTIFF (COGEO) creation plugin for rasterio",
long_description=readme,
long_description_content_type="text/markdown",
| cogeotiff/rio-cogeo | 7764b45e4489d742c65d7c2e4eaa7c5c53402392 | diff --git a/tests/test_cli.py b/tests/test_cli.py
index 46c21df..3e1c987 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -46,9 +46,7 @@ def test_cogeo_valid():
assert src.height == 512
assert src.width == 512
assert src.meta["dtype"] == "uint8"
- assert (
- not src.is_tiled
- ) # Because blocksize is 512 and the file is 512, the output is not tiled
+ assert src.is_tiled
assert src.compression.value == "DEFLATE"
assert not src.photometric
assert src.interleaving.value == "PIXEL"
@@ -204,9 +202,7 @@ def test_cogeo_validOvrOption():
assert not result.exception
assert result.exit_code == 0
with rasterio.open("output.tif") as src:
- assert (
- not src.is_tiled
- ) # Because blocksize is 512 and the file is 512, the output is not tiled
+ assert src.is_tiled
assert src.overviews(1) == [2, 4]
diff --git a/tests/test_cogeo.py b/tests/test_cogeo.py
index 14d35d4..657cd53 100644
--- a/tests/test_cogeo.py
+++ b/tests/test_cogeo.py
@@ -292,3 +292,25 @@ def test_cog_translate_valid_blocksize():
assert not src.profile.get("blockxsize")
assert not src.profile.get("blockysize")
assert not src.overviews(1)
+
+
+def test_cog_translate_validDataset():
+ """Should work as expected (create cogeo from an open dataset)."""
+ runner = CliRunner()
+ with runner.isolated_filesystem():
+ with rasterio.open(raster_path_rgb) as src_dst:
+ cog_translate(src_dst, "cogeo.tif", jpeg_profile, quiet=True)
+
+ with rasterio.open("cogeo.tif") as src:
+ assert src.height == 512
+ assert src.width == 512
+ assert src.meta["dtype"] == "uint8"
+ assert src.is_tiled
+ assert src.profile["blockxsize"] == 64
+ assert src.profile["blockysize"] == 64
+ assert src.compression.value == "JPEG"
+ assert src.photometric.value == "YCbCr"
+ assert src.interleaving.value == "PIXEL"
+ assert src.overviews(1) == [2, 4, 8]
+ assert src.tags()["OVR_RESAMPLING_ALG"] == "NEAREST"
+ assert not has_mask_band(src)
diff --git a/tests/test_validate.py b/tests/test_validate.py
index 7014f5b..bde475b 100644
--- a/tests/test_validate.py
+++ b/tests/test_validate.py
@@ -62,6 +62,8 @@ def test_cog_validate_validCreatioValid(monkeypatch):
)
assert cog_validate("cogeo.tif")
+ # Change in rasterio 1.0.26
+ # https://github.com/mapbox/rasterio/blob/master/CHANGES.txt#L43
config = dict(GDAL_TIFF_OVR_BLOCKSIZE="1024")
cog_translate(
raster_big,
@@ -71,4 +73,4 @@ def test_cog_validate_validCreatioValid(monkeypatch):
config=config,
quiet=True,
)
- assert not cog_validate("cogeo.tif")
+ assert cog_validate("cogeo.tif")
| datatype option
following #85, a fix has been pushed to rasterio so now we need to add an option or a default behaviour to rio-cogeo to handle datatype inheritance...
ref https://github.com/mapbox/rasterio/pull/1768 | 0.0 | 7764b45e4489d742c65d7c2e4eaa7c5c53402392 | [
"tests/test_cli.py::test_cogeo_valid_external_mask",
"tests/test_cli.py::test_cogeo_validbidx",
"tests/test_cli.py::test_cogeo_invalidbidx",
"tests/test_cli.py::test_cogeo_invalidbidxString",
"tests/test_cli.py::test_cogeo_validnodata",
"tests/test_cli.py::test_cogeo_validGdalOptions",
"tests/test_cli.py::test_cogeo_validOvrOption",
"tests/test_cli.py::test_cogeo_web",
"tests/test_cli.py::test_cogeo_validgdalBlockOption",
"tests/test_cli.py::test_cogeo_validNodataCustom",
"tests/test_cli.py::test_cogeo_validTempFile",
"tests/test_validate.py::test_cog_validate_valid"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_issue_reference",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-09-10 14:18:15+00:00 | bsd-3-clause | 1,637 |
|
cogeotiff__rio-cogeo-98 | diff --git a/CHANGES.txt b/CHANGES.txt
index 3af9049..4ca6200 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,10 @@
+1.1.3 (2019-09-16)
+------------------
+
+- Add lzma/lerc/lerc_deflate/lerc_zstd profiles (#97)
+- Add warnings and notes for `non-standard` compression (#97)
+- fix THREADS definition for GDAL config
+
1.1.2 (2019-09-12)
------------------
diff --git a/README.md b/README.md
index f812c9a..6353a6c 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,8 @@ $ rio cogeo create --help
Options:
-b, --bidx BIDX Band indexes to copy.
- -p, --cog-profile [jpeg|webp|zstd|lzw|deflate|packbits|raw] CloudOptimized GeoTIFF profile (default: deflate).
+ -p, --cog-profile [jpeg|webp|zstd|lzw|deflate|packbits|lzma|lerc|lerc_deflate|lerc_zstd|raw]
+ CloudOptimized GeoTIFF profile (default: deflate).
--nodata NUMBER|nan Set nodata masking values for input dataset.
--add-mask Force output dataset creation with an internal mask (convert alpha band or nodata to mask).
-t, --dtype [ubyte|uint8|uint16|int16|uint32|int32|float32|float64]
@@ -77,7 +78,7 @@ $ rio cogeo create --help
or ensure MAX_ZOOM equality for multiple dataset accross latitudes.
-r, --resampling [nearest|bilinear|cubic|cubic_spline|lanczos|average|mode|gauss] Resampling algorithm.
--in-memory / --no-in-memory Force processing raster in memory / not in memory (default: process in memory if smaller than 120 million pixels)
- --threads INTEGER
+ --threads THREADS Number of worker threads for multi-threaded compression (default: ALL_CPUS)
--co, --profile NAME=VALUE Driver specific creation options.See the documentation for the selected output driver for more information.
-q, --quiet Remove progressbar and other non-error output.
--help Show this message and exit.
@@ -110,6 +111,8 @@ $ rio cogeo create mydataset.tif mydataset_jpeg.tif -b 1,2,3 --add-mask --cog-pr
## Default COGEO profiles
+Default profiles are tiled with 512x512 blocksizes.
+
**JPEG**
- JPEG compression
@@ -122,12 +125,14 @@ $ rio cogeo create mydataset.tif mydataset_jpeg.tif -b 1,2,3 --add-mask --cog-pr
- WEBP compression
- PIXEL interleave
- limited to uint8 datatype and 3 or 4 bands data
+- Non-Standard, might not be supported by software not build against GDAL+internal libtiff + libwebp
- Available for GDAL>=2.4.0
**ZSTD**
- ZSTD compression
- PIXEL interleave
+- Non-Standard, might not be supported by software not build against GDAL + internal libtiff + libzstd
- Available for GDAL>=2.3.0
*Note* in Nov 2018, there was a change in libtiff's ZSTD tags which create incompatibility for old ZSTD compressed GeoTIFF [(link)](https://lists.osgeo.org/pipermail/gdal-dev/2018-November/049289.html)
@@ -147,14 +152,41 @@ $ rio cogeo create mydataset.tif mydataset_jpeg.tif -b 1,2,3 --add-mask --cog-pr
- PACKBITS compression
- PIXEL interleave
+**LZMA**
+
+- LZMA compression
+- PIXEL interleave
+
+**LERC**
+
+- LERC compression
+- PIXEL interleave
+- Default MAX_Z_ERROR=0 (lossless)
+- Non-Standard, might not be supported by software not build against GDAL + internal libtiff
+- Available for GDAL>=2.4.0
+
+**LERC_DEFLATE**
+
+- LERC_DEFLATE compression
+- PIXEL interleave
+- Default MAX_Z_ERROR=0 (lossless)
+- Non-Standard, might not be supported by software not build against GDAL + internal libtiff + libzstd
+- Available for GDAL>=2.4.0
+
+**LERC_ZSTD**
+
+- LERC_ZSTD compression
+- PIXEL interleave
+- Default MAX_Z_ERROR=0 (lossless)
+- Non-Standard, might not be supported by software not build against GDAL + internal libtiff + libzstd
+- Available for GDAL>=2.4.0
+
**RAW**
- NO compression
- PIXEL interleave
-Default profiles are tiled with 512x512 blocksizes.
-
-Profiles can be extended by providing '--co' option in command line
+**Profiles can be extended by providing '--co' option in command line**
```bash
@@ -162,6 +194,8 @@ Profiles can be extended by providing '--co' option in command line
$ rio cogeo create mydataset.tif mydataset_raw.tif --co BLOCKXSIZE=1024 --co BLOCKYSIZE=1024 --cog-profile raw --overview-blocksize 256
```
+See https://gdal.org/drivers/raster/gtiff.html#creation-options for full details of creation options.
+
## Web-Optimized COG
rio-cogeo provide a *--web-optimized* option which aims to create a web-tiling friendly COG.
diff --git a/rio_cogeo/profiles.py b/rio_cogeo/profiles.py
index 8fb1bae..9a91747 100644
--- a/rio_cogeo/profiles.py
+++ b/rio_cogeo/profiles.py
@@ -1,5 +1,7 @@
"""rio_cogeo.profiles: CloudOptimized profiles."""
+import warnings
+
from rasterio.profiles import Profile
@@ -85,6 +87,58 @@ class PACKBITSProfile(Profile):
}
+class LZMAProfile(Profile):
+ """Tiled, pixel-interleaved, LZMA-compressed GTiff."""
+
+ defaults = {
+ "driver": "GTiff",
+ "interleave": "pixel",
+ "tiled": True,
+ "blockxsize": 512,
+ "blockysize": 512,
+ "compress": "LZMA",
+ }
+
+
+class LERCProfile(Profile):
+ """Tiled, pixel-interleaved, LERC-compressed GTiff."""
+
+ defaults = {
+ "driver": "GTiff",
+ "interleave": "pixel",
+ "tiled": True,
+ "blockxsize": 512,
+ "blockysize": 512,
+ "compress": "LERC",
+ }
+
+
+class LERCDEFLATEProfile(Profile):
+ """Tiled, pixel-interleaved, LERC_DEFLATE-compressed GTiff."""
+
+ defaults = {
+ "driver": "GTiff",
+ "interleave": "pixel",
+ "tiled": True,
+ "blockxsize": 512,
+ "blockysize": 512,
+ "compress": "LERC_DEFLATE",
+ }
+
+
+class LERCZSTDProfile(Profile):
+ """Tiled, pixel-interleaved, LERC_ZSTD-compressed GTiff."""
+
+ defaults = {
+ "driver": "GTiff",
+ "interleave": "pixel",
+ "tiled": True,
+ "blockxsize": 512,
+ "blockysize": 512,
+ "compress": "LERC_ZSTD",
+ }
+
+
class RAWProfile(Profile):
"""Tiled, pixel-interleaved, no-compressed GTiff."""
@@ -110,6 +164,10 @@ class COGProfiles(dict):
"lzw": LZWProfile(),
"deflate": DEFLATEProfile(),
"packbits": PACKBITSProfile(),
+ "lzma": LZMAProfile(),
+ "lerc": LERCProfile(),
+ "lerc_deflate": LERCDEFLATEProfile(),
+ "lerc_zstd": LERCZSTDProfile(),
"raw": RAWProfile(),
}
)
@@ -119,6 +177,12 @@ class COGProfiles(dict):
if key not in (self.keys()):
raise KeyError("{} is not a valid COG profile name".format(key))
+ if key in ["zstd", "webp", "lerc", "lerc_deflate", "lerc_zstd"]:
+ warnings.warn(
+ "Non-standard compression schema: {}. The output COG might not be fully"
+ " supported by software not build against latest libtiff.".format(key)
+ )
+
return self[key].copy()
diff --git a/rio_cogeo/scripts/cli.py b/rio_cogeo/scripts/cli.py
index 75c1034..9f244fb 100644
--- a/rio_cogeo/scripts/cli.py
+++ b/rio_cogeo/scripts/cli.py
@@ -17,7 +17,7 @@ IN_MEMORY_THRESHOLD = int(os.environ.get("IN_MEMORY_THRESHOLD", 10980 * 10980))
class BdxParamType(click.ParamType):
- """Band inddex type."""
+ """Band index type."""
name = "bidx"
@@ -36,7 +36,7 @@ class BdxParamType(click.ParamType):
class NodataParamType(click.ParamType):
- """Nodata inddex type."""
+ """Nodata type."""
name = "nodata"
@@ -53,6 +53,22 @@ class NodataParamType(click.ParamType):
raise click.ClickException("{} is not a valid nodata value.".format(value))
+class ThreadsParamType(click.ParamType):
+ """num_threads index type."""
+
+ name = "threads"
+
+ def convert(self, value, param, ctx):
+ """Validate and parse thread number."""
+ try:
+ if value.lower() == "all_cpus":
+ return "ALL_CPUS"
+ else:
+ return int(value)
+ except (TypeError, ValueError):
+ raise click.ClickException("{} is not a valid thread value.".format(value))
+
+
@click.group(short_help="Create and Validate COGEO")
@click.version_option(version=cogeo_version, message="%(version)s")
def cogeo():
@@ -131,7 +147,12 @@ def cogeo():
help="Force processing raster in memory / not in memory (default: process in memory "
"if smaller than {:.0f} million pixels)".format(IN_MEMORY_THRESHOLD // 1e6),
)
[email protected]("--threads", type=int, default=8)
[email protected](
+ "--threads",
+ type=ThreadsParamType(),
+ default="ALL_CPUS",
+ help="Number of worker threads for multi-threaded compression (default: ALL_CPUS)",
+)
@options.creation_options
@click.option(
"--quiet", "-q", help="Remove progressbar and other non-error output.", is_flag=True
@@ -168,7 +189,7 @@ def create(
output_profile.update(creation_options)
config = dict(
- NUM_THREADS=threads,
+ GDAL_NUM_THREADS=threads,
GDAL_TIFF_INTERNAL_MASK=os.environ.get("GDAL_TIFF_INTERNAL_MASK", True),
GDAL_TIFF_OVR_BLOCKSIZE=str(overview_blocksize),
)
diff --git a/setup.py b/setup.py
index 59bd20d..b65831a 100644
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,7 @@ if sys.version_info >= (3, 6):
setup(
name="rio-cogeo",
- version="1.1.2",
+ version="1.1.3",
description=u"CloudOptimized GeoTIFF (COGEO) creation plugin for rasterio",
long_description=readme,
long_description_content_type="text/markdown",
| cogeotiff/rio-cogeo | fdda823e836bc9614f522ced349d5e1281fb8706 | diff --git a/tests/test_profile.py b/tests/test_profile.py
index 71ce037..f470442 100644
--- a/tests/test_profile.py
+++ b/tests/test_profile.py
@@ -55,6 +55,46 @@ def test_profiles_packbits():
assert profile["interleave"] == "pixel"
+def test_profiles_lzma():
+ """Should work as expected (return lzma profile)."""
+ profile = cog_profiles.get("lzma")
+ assert profile["tiled"]
+ assert profile["compress"] == "LZMA"
+ assert profile["blockxsize"] == 512
+ assert profile["blockysize"] == 512
+ assert profile["interleave"] == "pixel"
+
+
+def test_profiles_lerc():
+ """Should work as expected (return lerc profile)."""
+ profile = cog_profiles.get("lerc")
+ assert profile["tiled"]
+ assert profile["compress"] == "LERC"
+ assert profile["blockxsize"] == 512
+ assert profile["blockysize"] == 512
+ assert profile["interleave"] == "pixel"
+
+
+def test_profiles_lerc_deflate():
+ """Should work as expected (return lerc_deflate profile)."""
+ profile = cog_profiles.get("lerc_deflate")
+ assert profile["tiled"]
+ assert profile["compress"] == "LERC_DEFLATE"
+ assert profile["blockxsize"] == 512
+ assert profile["blockysize"] == 512
+ assert profile["interleave"] == "pixel"
+
+
+def test_profiles_lerc_zstd():
+ """Should work as expected (return lerc_deflate profile)."""
+ profile = cog_profiles.get("lerc_zstd")
+ assert profile["tiled"]
+ assert profile["compress"] == "LERC_ZSTD"
+ assert profile["blockxsize"] == 512
+ assert profile["blockysize"] == 512
+ assert profile["interleave"] == "pixel"
+
+
def test_profiles_raw():
"""Should work as expected (return packbits profile)."""
profile = cog_profiles.get("raw")
@@ -65,6 +105,12 @@ def test_profiles_raw():
assert profile["interleave"] == "pixel"
+def test_profiles_nonstandard():
+ """Should work as expected (warns on non-standard compression)."""
+ with pytest.warns(UserWarning):
+ cog_profiles.get("zstd")
+
+
def test_profiles_copy():
"""'get' should perform a dict copy."""
profile = cog_profiles.get("raw")
| ZSTD missing codec
Thanks for this lib/plugin, it's really helpful and avoids having to guess which creation options are good for remote access.
I'm encountering a problem with the `zstd` `cog-profile`.
When running:
```
rio cogeo create -p zstd S2A_MSIL1C_20190112T175711_N0207_R141_T13UFQ_20190112T194934__B01.jp2 out.tiff
```
I get the following traceback:
```
Reading input: /home/guillaumelostis/code/s2-cog-benchmark/tiles/S2A_MSIL1C_20190112T175711_N0207_R141_T13UFQ_20190112T194934__B01.jp2
Adding overviews...
Updating dataset tags...
Writing output to: /home/guillaumelostis/code/s2-cog-benchmark/tiles/tiff/zstd.tiff
WARNING:rasterio._env:CPLE_NotSupported in 'ZSTD' is an unexpected value for COMPRESS creation option of type string-select.
Traceback (most recent call last):
File "/home/guillaumelostis/.venv/bench/bin/rio", line 11, in <module>
sys.exit(main_group())
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/rio_cogeo/scripts/cli.py", line 191, in create
quiet=quiet,
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/rio_cogeo/cogeo.py", line 268, in cog_translate
copy(tmp_dst, dst_path, copy_src_overviews=True, **dst_kwargs)
File "/home/guillaumelostis/.venv/bench/lib/python3.6/site-packages/rasterio/env.py", line 445, in wrapper
return f(*args, **kwds)
File "rasterio/shutil.pyx", line 139, in rasterio.shutil.copy
File "rasterio/_err.pyx", line 205, in rasterio._err.exc_wrap_pointer
rasterio._err.CPLE_AppDefinedError: Cannot create TIFF file due to missing codec for ZSTD.
```
I run this in a fresh virtual environment where I have `pip install rio-cogeo`.
Is the problem that the `GDAL` lib that came packaged with the `rasterio` wheel doesn't support `ZSTD`? That seems surprising. For reference, the `rasterio` wheel that was installed is https://files.pythonhosted.org/packages/e1/2e/af9bfa901b890800b25428ab9846fe4e91818a94ede227c1a2d4410bac54/rasterio-1.0.28-cp36-cp36m-manylinux1_x86_64.whl
Or is something wrong with my local setup? | 0.0 | fdda823e836bc9614f522ced349d5e1281fb8706 | [
"tests/test_profile.py::test_profiles_lzma",
"tests/test_profile.py::test_profiles_lerc",
"tests/test_profile.py::test_profiles_lerc_deflate",
"tests/test_profile.py::test_profiles_lerc_zstd",
"tests/test_profile.py::test_profiles_nonstandard"
]
| [
"tests/test_profile.py::test_profiles_jpeg",
"tests/test_profile.py::test_profiles_webp",
"tests/test_profile.py::test_profiles_lzw",
"tests/test_profile.py::test_profiles_deflate",
"tests/test_profile.py::test_profiles_packbits",
"tests/test_profile.py::test_profiles_raw",
"tests/test_profile.py::test_profiles_copy",
"tests/test_profile.py::test_profiles_error"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-09-16 15:52:25+00:00 | bsd-3-clause | 1,638 |
|
cogeotiff__rio-tiler-mosaic-5 | diff --git a/CHANGES.txt b/CHANGES.txt
index 3d9381a..4589e88 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,8 @@
+0.0.1dev2 (2019-07-18)
+--------------------
+- Force output data type to be the same as the input datatype
+from Mean and Median method#4
+
0.0.1dev1 (2019-07-18)
--------------------
diff --git a/rio_tiler_mosaic/methods/defaults.py b/rio_tiler_mosaic/methods/defaults.py
index a5b6760..b5d0721 100644
--- a/rio_tiler_mosaic/methods/defaults.py
+++ b/rio_tiler_mosaic/methods/defaults.py
@@ -61,11 +61,18 @@ class LowestMethod(MosaicMethodBase):
class MeanMethod(MosaicMethodBase):
"""Feed the mosaic tile with the Mean pixel value."""
+ def __init__(self, enforce_data_type=True):
+ """Overwrite base and init Mean method."""
+ super(MeanMethod, self).__init__()
+ self.enforce_data_type = enforce_data_type
+
@property
def data(self):
"""Return data and mask."""
if self.tile is not None:
tile = numpy.ma.mean(self.tile, axis=0)
+ if self.enforce_data_type:
+ tile = tile.astype(self.tile.dtype)
return tile.data, ~tile.mask[0] * 255
else:
return None, None
@@ -82,11 +89,18 @@ class MeanMethod(MosaicMethodBase):
class MedianMethod(MosaicMethodBase):
"""Feed the mosaic tile with the Median pixel value."""
+ def __init__(self, enforce_data_type=True):
+ """Overwrite base and init Median method."""
+ super(MedianMethod, self).__init__()
+ self.enforce_data_type = enforce_data_type
+
@property
def data(self):
"""Return data and mask."""
if self.tile is not None:
tile = numpy.ma.median(self.tile, axis=0)
+ if self.enforce_data_type:
+ tile = tile.astype(self.tile.dtype)
return tile.data, ~tile.mask[0] * 255
else:
return None, None
diff --git a/setup.py b/setup.py
index c53ad3d..2e82b8b 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ with open("README.md") as f:
setup(
name="rio-tiler-mosaic",
- version="0.0.1dev1",
+ version="0.0.1dev2",
long_description=long_description,
long_description_content_type="text/markdown",
description=u"""A rio-tiler plugin to create mosaic tiles.""",
| cogeotiff/rio-tiler-mosaic | 7970c6412e0793f81c3dece45b109395b550764d | diff --git a/tests/test_mosaic.py b/tests/test_mosaic.py
index d15eb0f..5475008 100644
--- a/tests/test_mosaic.py
+++ b/tests/test_mosaic.py
@@ -91,6 +91,18 @@ def test_mosaic_tiler():
assets, x, y, z, cogTiler, pixel_selection=defaults.MeanMethod()
)
assert m.all()
+ assert t[0][-1][-1] == 7822
+
+ # Test mean pixel selection
+ t, m = mosaic.mosaic_tiler(
+ assets,
+ x,
+ y,
+ z,
+ cogTiler,
+ pixel_selection=defaults.MeanMethod(enforce_data_type=False),
+ )
+ assert m.all()
assert t[0][-1][-1] == 7822.5
# Test median pixel selection
@@ -98,6 +110,18 @@ def test_mosaic_tiler():
assets, x, y, z, cogTiler, pixel_selection=defaults.MedianMethod()
)
assert m.all()
+ assert t[0][-1][-1] == 7822
+
+ # Test median pixel selection
+ t, m = mosaic.mosaic_tiler(
+ assets,
+ x,
+ y,
+ z,
+ cogTiler,
+ pixel_selection=defaults.MedianMethod(enforce_data_type=False),
+ )
+ assert m.all()
assert t[0][-1][-1] == 7822.5
# Test invalid Pixel Selection class
| Mean and Median should return the same data type ?
A mean or a median value might not be the same datatype as the input tiles and thus it can lead to unexpected behaviour.
IMO we should add an option to `cast` the output data to the same data type as the input tile array | 0.0 | 7970c6412e0793f81c3dece45b109395b550764d | [
"tests/test_mosaic.py::test_mosaic_tiler"
]
| []
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-07-19 01:35:52+00:00 | mit | 1,639 |
|
colinfike__easy-ptvsd-2 | diff --git a/.gitignore b/.gitignore
index cb1663a..473dc19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
__pycache__
*.egg-info
dist
+*.pyc
diff --git a/easy_ptvsd.py b/easy_ptvsd.py
index 6af5619..538747f 100644
--- a/easy_ptvsd.py
+++ b/easy_ptvsd.py
@@ -30,9 +30,11 @@ class wait_and_break:
def __call__(self, function):
"""Run ptvsd code and continue with decorated function."""
+
def wait_and_break_deco(*args, **kwargs):
ptvsd.enable_attach(self.secret, address=self.address)
ptvsd.wait_for_attach()
ptvsd.break_into_debugger()
- function(*args, **kwargs)
+ return function(*args, **kwargs)
+
return wait_and_break_deco
diff --git a/setup.py b/setup.py
index 91fccaf..dac13b1 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
setup(
name="easy_ptvsd",
- version="0.1.0",
+ version="0.1.1",
description="A convenience package for PTVSD.",
long_description=(
"EasyPtvsd is a convenience library that makes it a bit easy to remote"
@@ -16,16 +16,14 @@ setup(
author_email="[email protected]",
license="MIT",
classifiers=[
- 'Development Status :: 3 - Alpha',
- 'Intended Audience :: Developers',
- 'Topic :: Software Development',
- 'Programming Language :: Python :: 3',
+ "Development Status :: 3 - Alpha",
+ "Intended Audience :: Developers",
+ "Topic :: Software Development",
+ "Programming Language :: Python :: 3",
],
keywords="ptvsd easy python remote debugging",
- install_requires=[
- 'ptvsd==3.0.0',
- ],
- python_requires='>=3',
+ install_requires=["ptvsd==3.0.0"],
+ python_requires=">=3",
py_modules=["easy_ptvsd"],
packages=[],
)
| colinfike/easy-ptvsd | 6ec7940a227939039464fb4e9beb48819470d8b4 | diff --git a/tests/test_easy_ptvsd.py b/tests/test_easy_ptvsd.py
index 945c629..63587e5 100644
--- a/tests/test_easy_ptvsd.py
+++ b/tests/test_easy_ptvsd.py
@@ -32,15 +32,16 @@ class TestWaitAndBreakClass(unittest.TestCase):
@patch("easy_ptvsd.ptvsd")
def test_decorated_function_wrapper_functionality(self, mock_ptvsd):
"""Test that the function returned by invoking wait_and_break is functional."""
- decorated_func_mock = Mock()
+ decorated_func_mock = Mock(return_value="ret val")
wait_and_break_obj = wait_and_break()
result = wait_and_break_obj(decorated_func_mock)
- result("positional_arg", key_word_arg="keywordarg")
+ return_value = result("positional_arg", key_word_arg="keywordarg")
self.assertTrue(mock_ptvsd.enable_attach.called)
self.assertTrue(mock_ptvsd.wait_for_attach.called)
self.assertTrue(mock_ptvsd.break_into_debugger.called)
+ self.assertEqual(return_value, "ret val")
decorated_func_mock.assert_called_once_with(
"positional_arg", key_word_arg="keywordarg"
)
| Strange functionality when used with @classmethod decorator
I'm seeing return values not being returned when using `wait_and_break` with `@classmethod` decorator.
Actually this is issue is definitely that I don't return the value the decorated function returns. | 0.0 | 6ec7940a227939039464fb4e9beb48819470d8b4 | [
"tests/test_easy_ptvsd.py::TestWaitAndBreakClass::test_decorated_function_wrapper_functionality"
]
| [
"tests/test_easy_ptvsd.py::TestWaitAndBreakClass::test_custom_init_parameters",
"tests/test_easy_ptvsd.py::TestWaitAndBreakClass::test_default_init_parameters",
"tests/test_easy_ptvsd.py::TestWaitAndBreakClass::test_invocation_returns_function"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2018-04-19 21:00:42+00:00 | mit | 1,640 |
|
collective__icalendar-185 | diff --git a/CHANGES.rst b/CHANGES.rst
index 5fbf217..b323e83 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -7,10 +7,13 @@ Changelog
New:
- *add item here*
+- Updated components description to better comply with RFC 5545.
+ [stlaz]
Fixes:
- Fix testsuite for use with ``dateutil>=2.5``. Refs #195.
+- Reintroduce cal.Component.is_broken that was removed with 3.9.2 [geier]
3.9.2 (2016-02-05)
diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py
index 9828c54..9c854eb 100644
--- a/src/icalendar/cal.py
+++ b/src/icalendar/cal.py
@@ -106,6 +106,10 @@ class Component(CaselessDict):
"""
return True if not (list(self.values()) + self.subcomponents) else False # noqa
+ @property
+ def is_broken(self):
+ return bool(self.errors)
+
#############################
# handling of property values
@@ -432,7 +436,7 @@ class Component(CaselessDict):
#######################################
-# components defined in RFC 2445
+# components defined in RFC 5545
class Event(Component):
@@ -440,21 +444,21 @@ class Event(Component):
canonical_order = (
'SUMMARY', 'DTSTART', 'DTEND', 'DURATION', 'DTSTAMP',
- 'UID', 'RECURRENCE-ID', 'SEQUENCE',
- 'RRULE' 'EXRULE', 'RDATE', 'EXDATE',
+ 'UID', 'RECURRENCE-ID', 'SEQUENCE', 'RRULE', 'RDATE',
+ 'EXDATE',
)
- required = ('UID',)
+ required = ('UID', 'DTSTAMP',)
singletons = (
'CLASS', 'CREATED', 'DESCRIPTION', 'DTSTART', 'GEO', 'LAST-MODIFIED',
'LOCATION', 'ORGANIZER', 'PRIORITY', 'DTSTAMP', 'SEQUENCE', 'STATUS',
'SUMMARY', 'TRANSP', 'URL', 'RECURRENCE-ID', 'DTEND', 'DURATION',
- 'DTSTART',
+ 'UID',
)
- exclusive = ('DTEND', 'DURATION', )
+ exclusive = ('DTEND', 'DURATION',)
multiple = (
'ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'EXDATE',
- 'EXRULE', 'RSTATUS', 'RELATED', 'RESOURCES', 'RDATE', 'RRULE'
+ 'RSTATUS', 'RELATED', 'RESOURCES', 'RDATE', 'RRULE'
)
ignore_exceptions = True
@@ -463,7 +467,7 @@ class Todo(Component):
name = 'VTODO'
- required = ('UID',)
+ required = ('UID', 'DTSTAMP',)
singletons = (
'CLASS', 'COMPLETED', 'CREATED', 'DESCRIPTION', 'DTSTAMP', 'DTSTART',
'GEO', 'LAST-MODIFIED', 'LOCATION', 'ORGANIZER', 'PERCENT-COMPLETE',
@@ -473,7 +477,7 @@ class Todo(Component):
exclusive = ('DUE', 'DURATION',)
multiple = (
'ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'EXDATE',
- 'EXRULE', 'RSTATUS', 'RELATED', 'RESOURCES', 'RDATE', 'RRULE'
+ 'RSTATUS', 'RELATED', 'RESOURCES', 'RDATE', 'RRULE'
)
@@ -481,15 +485,14 @@ class Journal(Component):
name = 'VJOURNAL'
- required = ('UID',)
+ required = ('UID', 'DTSTAMP',)
singletons = (
- 'CLASS', 'CREATED', 'DESCRIPTION', 'DTSTART', 'DTSTAMP',
- 'LAST-MODIFIED', 'ORGANIZER', 'RECURRENCE-ID', 'SEQUENCE', 'STATUS',
- 'SUMMARY', 'UID', 'URL',
+ 'CLASS', 'CREATED', 'DTSTART', 'DTSTAMP', 'LAST-MODIFIED', 'ORGANIZER',
+ 'RECURRENCE-ID', 'SEQUENCE', 'STATUS', 'SUMMARY', 'UID', 'URL',
)
multiple = (
'ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'EXDATE',
- 'EXRULE', 'RELATED', 'RDATE', 'RRULE', 'RSTATUS',
+ 'RELATED', 'RDATE', 'RRULE', 'RSTATUS', 'DESCRIPTION',
)
@@ -497,9 +500,9 @@ class FreeBusy(Component):
name = 'VFREEBUSY'
- required = ('UID',)
+ required = ('UID', 'DTSTAMP',)
singletons = (
- 'CONTACT', 'DTSTART', 'DTEND', 'DURATION', 'DTSTAMP', 'ORGANIZER',
+ 'CONTACT', 'DTSTART', 'DTEND', 'DTSTAMP', 'ORGANIZER',
'UID', 'URL',
)
multiple = ('ATTENDEE', 'COMMENT', 'FREEBUSY', 'RSTATUS',)
@@ -507,8 +510,8 @@ class FreeBusy(Component):
class Timezone(Component):
name = 'VTIMEZONE'
- canonical_order = ('TZID', 'STANDARD', 'DAYLIGHT',)
- required = ('TZID', 'STANDARD', 'DAYLIGHT',)
+ canonical_order = ('TZID',)
+ required = ('TZID',) # it also requires one of components DAYLIGHT and STANDARD
singletons = ('TZID', 'LAST-MODIFIED', 'TZURL',)
@staticmethod
@@ -631,24 +634,28 @@ class Timezone(Component):
class TimezoneStandard(Component):
name = 'STANDARD'
required = ('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM')
- singletons = ('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM', 'RRULE')
- multiple = ('COMMENT', 'RDATE', 'TZNAME')
+ singletons = ('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM',)
+ multiple = ('COMMENT', 'RDATE', 'TZNAME', 'RRULE', 'EXDATE')
class TimezoneDaylight(Component):
name = 'DAYLIGHT'
- required = ('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM')
- singletons = ('DTSTART', 'TZOFFSETTO', 'TZOFFSETFROM', 'RRULE')
- multiple = ('COMMENT', 'RDATE', 'TZNAME')
+ required = TimezoneStandard.required
+ singletons = TimezoneStandard.singletons
+ multiple = TimezoneStandard.multiple
class Alarm(Component):
name = 'VALARM'
- # not quite sure about these ...
+ # some properties MAY/MUST/MUST NOT appear depending on ACTION value
required = ('ACTION', 'TRIGGER',)
- singletons = ('ATTACH', 'ACTION', 'TRIGGER', 'DURATION', 'REPEAT',)
- inclusive = (('DURATION', 'REPEAT',),)
+ singletons = (
+ 'ATTACH', 'ACTION', 'DESCRIPTION', 'SUMMARY', 'TRIGGER',
+ 'DURATION', 'REPEAT',
+ )
+ inclusive = (('DURATION', 'REPEAT',), ('SUMMARY', 'ATTENDEE',))
+ multiple = ('ATTENDEE', 'ATTACH')
class Calendar(Component):
@@ -656,9 +663,8 @@ class Calendar(Component):
"""
name = 'VCALENDAR'
canonical_order = ('VERSION', 'PRODID', 'CALSCALE', 'METHOD',)
- required = ('prodid', 'version', )
- singletons = ('prodid', 'version', )
- multiple = ('calscale', 'method', )
+ required = ('PRODID', 'VERSION', )
+ singletons = ('PRODID', 'VERSION', 'CALSCALE', 'METHOD')
# These are read only singleton, so one instance is enough for the module
types_factory = TypesFactory()
| collective/icalendar | 6888bbe02042cd65b12a6d855b527a964a4b823b | diff --git a/src/icalendar/tests/test_fixed_issues.py b/src/icalendar/tests/test_fixed_issues.py
index ae29535..6b375d3 100644
--- a/src/icalendar/tests/test_fixed_issues.py
+++ b/src/icalendar/tests/test_fixed_issues.py
@@ -200,6 +200,7 @@ X
END:VEVENT"""
event = icalendar.Calendar.from_ical(ical_str)
self.assertTrue(isinstance(event, icalendar.Event))
+ self.assertTrue(event.is_broken) # REMOVE FOR NEXT MAJOR RELEASE
self.assertEqual(
event.errors,
[(None, "Content line could not be parsed into parts: 'X': Invalid content line")] # noqa
| incompatible changes in 3.9.2
With 70a7b5a16748afbf0d48ca180c2b7613fdd7e7d0 we introduced some backwards incompatible changes:
* `Component.is_broken` got replaced with `Component.errors`
* events with a `RDATE;VALUE=PERIOD:19970101T180000Z/19970102T070000Z,19970109T180000Z/PT5H30M` component still had an `RDATE` with `VALUE=PERIOD` param before, now they are `RDATE:None`
While I do agree with both changes, I think they should have been deferred to the 4.0.0 release. Because we don't have `VALUE=PERIOD` anyway I think we can leave this one as it is, but I believe we should bring back `Component.is_broken` for the 3.9.3 release.
| 0.0 | 6888bbe02042cd65b12a6d855b527a964a4b823b | [
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_104__ignore_exceptions"
]
| [
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_index_error_issue",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_100",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_101",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_104__no_ignore_exceptions",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_112",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_116",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_142",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_143",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_157",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_168",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_178",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_53",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_55",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_58",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_64",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_70",
"src/icalendar/tests/test_fixed_issues.py::TestIssues::test_issue_82"
]
| {
"failed_lite_validators": [
"has_git_commit_hash",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2016-02-14 13:25:31+00:00 | zpl-2.1 | 1,641 |
|
collective__icalendar-391 | diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py
index b6395df..36d2b94 100644
--- a/src/icalendar/prop.py
+++ b/src/icalendar/prop.py
@@ -323,6 +323,11 @@ class vDDDTypes:
else:
raise ValueError(f'Unknown date type: {type(dt)}')
+ def __eq__(self, other):
+ if isinstance(other, vDDDTypes):
+ return self.params == other.params
+ return False
+
@classmethod
def from_ical(cls, ical, timezone=None):
if isinstance(ical, cls):
| collective/icalendar | 5669f494586d7d78e8236926a973d29e90519824 | diff --git a/src/icalendar/tests/test_unit_prop.py b/src/icalendar/tests/test_unit_prop.py
index acfc788..0549320 100644
--- a/src/icalendar/tests/test_unit_prop.py
+++ b/src/icalendar/tests/test_unit_prop.py
@@ -112,6 +112,27 @@ class TestProp(unittest.TestCase):
# Bad input
self.assertRaises(ValueError, vDDDTypes, 42)
+ def test_vDDDTypes_equivalance(self):
+ from ..prop import vDDDTypes
+ from copy import deepcopy
+
+ vDDDTypes = [
+ vDDDTypes(pytz.timezone('US/Eastern').localize(datetime(year=2022, month=7, day=22, hour=12, minute=7))),
+ vDDDTypes(datetime(year=2022, month=7, day=22, hour=12, minute=7)),
+ vDDDTypes(date(year=2022, month=7, day=22)),
+ vDDDTypes(time(hour=22, minute=7, second=2))]
+
+ for v_type in vDDDTypes:
+ self.assertEqual(v_type, deepcopy(v_type))
+ for other in vDDDTypes:
+ if other is v_type:
+ continue
+ self.assertNotEqual(v_type, other)
+
+ # see if equivalnce fails for other types
+ self.assertNotEqual(v_type, 42)
+ self.assertNotEqual(v_type, 'test')
+
def test_prop_vDate(self):
from ..prop import vDate
| Missing equivalence member function for icalendar.prop.vDDDTypes
While comparing two vevents, I have to check if RECURRENCE-ID are the same in addition to UID.
However, `vevent1["RECURRENCE-ID"]==vevent2["RECURRENCE-ID"] `always returns false, as only the object ids are compared and not the content.
It would be helpful if `icalendar.prop.vDDDTypes` would implement `__eq__(self, other)`.
| 0.0 | 5669f494586d7d78e8236926a973d29e90519824 | [
"src/icalendar/tests/test_unit_prop.py::TestProp::test_vDDDTypes_equivalance"
]
| [
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_TypesFactory",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vBinary",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vBoolean",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vCalAddress",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vCategory",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDDDLists",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDDDTypes",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDate",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDatetime",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDuration",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vFloat",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vFrequency",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vGeo",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vInline",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vInt",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vPeriod",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vRecur",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vText",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vTime",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vUTCOffset",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vUri",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vWeekday",
"src/icalendar/tests/test_unit_prop.py::TestPropertyValues::test_vDDDLists_timezone",
"src/icalendar/tests/test_unit_prop.py::TestWindowsOlsonMapping::test_all",
"src/icalendar/tests/test_unit_prop.py::TestWindowsOlsonMapping::test_windows_timezone"
]
| {
"failed_lite_validators": [
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2022-08-29 08:46:59+00:00 | bsd-2-clause | 1,642 |
|
collective__icalendar-492 | diff --git a/CHANGES.rst b/CHANGES.rst
index b46dae7..d0682ba 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,11 +14,11 @@ Breaking changes:
New features:
-- ...
+- vDDDTypes is hashable #487 #492 [niccokunzmann]
Bug fixes:
-- ...
+- vDDDTypes' equality also checks the dt attribute #497 #492 [niccokunzmann]
5.0.2 (2022-11-03)
------------------
diff --git a/docs/maintenance.rst b/docs/maintenance.rst
index e977cbc..e9373f4 100644
--- a/docs/maintenance.rst
+++ b/docs/maintenance.rst
@@ -11,6 +11,7 @@ Maintainers
Currently, the maintainers are
- `@geier <https://github.com/geier>`_
+- `@jacadzaca <https://github.com/jacadzaca>`_
- `@niccokunzmann <https://github.com/niccokunzmann>`_
Maintainers need this:
diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py
index f6c261c..dcbb926 100644
--- a/src/icalendar/prop.py
+++ b/src/icalendar/prop.py
@@ -320,9 +320,12 @@ class vDDDTypes:
def __eq__(self, other):
if isinstance(other, vDDDTypes):
- return self.params == other.params
+ return self.params == other.params and self.dt == other.dt
return False
+ def __hash__(self):
+ return hash(self.dt)
+
@classmethod
def from_ical(cls, ical, timezone=None):
if isinstance(ical, cls):
| collective/icalendar | 9be5f7c9f282876c942f2a8fa8369e3fc70e1efa | diff --git a/src/icalendar/tests/test_unit_prop.py b/src/icalendar/tests/test_unit_prop.py
index 0549320..b732b23 100644
--- a/src/icalendar/tests/test_unit_prop.py
+++ b/src/icalendar/tests/test_unit_prop.py
@@ -4,10 +4,12 @@ from datetime import time
from datetime import timedelta
from icalendar.parser import Parameters
import unittest
-from icalendar.prop import vDatetime
+from icalendar.prop import vDatetime, vDDDTypes
from icalendar.windows_to_olson import WINDOWS_TO_OLSON
-
+import pytest
import pytz
+from copy import deepcopy
+from dateutil import tz
class TestProp(unittest.TestCase):
@@ -112,27 +114,6 @@ class TestProp(unittest.TestCase):
# Bad input
self.assertRaises(ValueError, vDDDTypes, 42)
- def test_vDDDTypes_equivalance(self):
- from ..prop import vDDDTypes
- from copy import deepcopy
-
- vDDDTypes = [
- vDDDTypes(pytz.timezone('US/Eastern').localize(datetime(year=2022, month=7, day=22, hour=12, minute=7))),
- vDDDTypes(datetime(year=2022, month=7, day=22, hour=12, minute=7)),
- vDDDTypes(date(year=2022, month=7, day=22)),
- vDDDTypes(time(hour=22, minute=7, second=2))]
-
- for v_type in vDDDTypes:
- self.assertEqual(v_type, deepcopy(v_type))
- for other in vDDDTypes:
- if other is v_type:
- continue
- self.assertNotEqual(v_type, other)
-
- # see if equivalnce fails for other types
- self.assertNotEqual(v_type, 42)
- self.assertNotEqual(v_type, 'test')
-
def test_prop_vDate(self):
from ..prop import vDate
@@ -518,6 +499,39 @@ class TestProp(unittest.TestCase):
)
+
+vDDDTypes_list = [
+ vDDDTypes(pytz.timezone('US/Eastern').localize(datetime(year=2022, month=7, day=22, hour=12, minute=7))),
+ vDDDTypes(datetime(year=2022, month=7, day=22, hour=12, minute=7)),
+ vDDDTypes(datetime(year=2022, month=7, day=22, hour=12, minute=7, tzinfo=tz.UTC)),
+ vDDDTypes(date(year=2022, month=7, day=22)),
+ vDDDTypes(date(year=2022, month=7, day=23)),
+ vDDDTypes(time(hour=22, minute=7, second=2))
+]
+
+def identity(x):
+ return x
+
[email protected]("map", [
+ deepcopy,
+ identity,
+ hash,
+])
[email protected]("v_type", vDDDTypes_list)
[email protected]("other", vDDDTypes_list)
+def test_vDDDTypes_equivalance(map, v_type, other):
+ if v_type is other:
+ assert map(v_type) == map(other), f"identity implies equality: {map.__name__}()"
+ assert not (map(v_type) != map(other)), f"identity implies equality: {map.__name__}()"
+ else:
+ assert map(v_type) != map(other), f"expected inequality: {map.__name__}()"
+ assert not (map(v_type) == map(other)), f"expected inequality: {map.__name__}()"
+
[email protected]("v_type", vDDDTypes_list)
+def test_inequality_with_different_types(v_type):
+ assert v_type != 42
+ assert v_type != 'test'
+
class TestPropertyValues(unittest.TestCase):
def test_vDDDLists_timezone(self):
| [REGRESSION] DDDType not hashable in icalendar 5
Compare this:
```
>>> import icalendar
>>> import datetime
>>> icalendar.__version__
'4.0.9'
>>> icalendar.vDDDTypes(datetime(2022,10,10)).__hash__()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>> icalendar.vDDDTypes(datetime.datetime(2022,10,10)).__hash__()
8729746249635
>>> icalendar.vDDDTypes(datetime.datetime(2022,10,10)).__hash__
<method-wrapper '__hash__' of vDDDTypes object at 0x7f08d6c97cd0>
>>>
```
with this:
```
>>> import icalendar
>>> import datetime
>>> icalendar.__version__
'5.0.1'
>>> icalendar.vDDDTypes(datetime.datetime(2022,10,10)).__hash__()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
>>> icalendar.vDDDTypes(datetime.datetime(2022,10,10)).__hash__
```
I noticed tests failing because of this in another project - https://github.com/niccokunzmann/python-recurring-ical-events/issues/99 | 0.0 | 9be5f7c9f282876c942f2a8fa8369e3fc70e1efa | [
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type0-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type1-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type2-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type3-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type4-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type5-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type0-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type1-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type2-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type2-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type2-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type3-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type4-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type5-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type0-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type1-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type1-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type1-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type2-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type3-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type4-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type5-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type0-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type1-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type2-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type3-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type4-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type4-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type4-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type5-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type0-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type1-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type2-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type3-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type3-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type3-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type4-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type5-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type0-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type1-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type2-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type3-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type4-hash]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type5-hash]"
]
| [
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_TypesFactory",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vBinary",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vBoolean",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vCalAddress",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vCategory",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDDDLists",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDDDTypes",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDate",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDatetime",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDuration",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vFloat",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vFrequency",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vGeo",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vInline",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vInt",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vPeriod",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vRecur",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vText",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vTime",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vUTCOffset",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vUri",
"src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vWeekday",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type0-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type0-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type1-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type1-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type2-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type2-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type3-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type3-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type4-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type4-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type5-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type5-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type0-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type0-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type1-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type1-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type3-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type3-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type4-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type4-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type5-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other1-v_type5-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type0-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type0-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type2-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type2-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type3-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type3-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type4-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type4-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type5-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type5-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type0-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type0-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type1-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type1-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type2-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type2-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type3-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type3-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type5-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other3-v_type5-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type0-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type0-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type1-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type1-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type2-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type2-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type4-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type4-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type5-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other4-v_type5-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type0-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type0-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type1-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type1-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type2-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type2-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type3-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type3-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type4-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type4-identity]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type5-deepcopy]",
"src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other5-v_type5-identity]",
"src/icalendar/tests/test_unit_prop.py::test_inequality_with_different_types[v_type0]",
"src/icalendar/tests/test_unit_prop.py::test_inequality_with_different_types[v_type1]",
"src/icalendar/tests/test_unit_prop.py::test_inequality_with_different_types[v_type2]",
"src/icalendar/tests/test_unit_prop.py::test_inequality_with_different_types[v_type3]",
"src/icalendar/tests/test_unit_prop.py::test_inequality_with_different_types[v_type4]",
"src/icalendar/tests/test_unit_prop.py::test_inequality_with_different_types[v_type5]",
"src/icalendar/tests/test_unit_prop.py::TestPropertyValues::test_vDDDLists_timezone",
"src/icalendar/tests/test_unit_prop.py::TestWindowsOlsonMapping::test_all",
"src/icalendar/tests/test_unit_prop.py::TestWindowsOlsonMapping::test_windows_timezone"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2022-11-10 09:19:49+00:00 | bsd-2-clause | 1,643 |
|
collective__icalendar-559 | diff --git a/CHANGES.rst b/CHANGES.rst
index 2d81830..0ae1673 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -18,6 +18,9 @@ New features:
Bug fixes:
+- Component._encode stops ignoring parameters argument on native values, now merges them
+ Fixes: #557
+ [zocker1999net]
- ...
5.0.9 (2023-09-24)
diff --git a/docs/credits.rst b/docs/credits.rst
index 1343193..eedcc24 100644
--- a/docs/credits.rst
+++ b/docs/credits.rst
@@ -70,6 +70,7 @@ icalendar contributors
- `Natasha Mattson <https://github.com/natashamm`_
- `NikEasY <https://github.com/NikEasY>`_
- Matt Lewis <[email protected]>
+- Felix Stupp <[email protected]>
Find out who contributed::
diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py
index 4088971..2535680 100644
--- a/src/icalendar/cal.py
+++ b/src/icalendar/cal.py
@@ -113,7 +113,8 @@ class Component(CaselessDict):
#############################
# handling of property values
- def _encode(self, name, value, parameters=None, encode=1):
+ @staticmethod
+ def _encode(name, value, parameters=None, encode=1):
"""Encode values to icalendar property values.
:param name: Name of the property.
@@ -138,17 +139,19 @@ class Component(CaselessDict):
return value
if isinstance(value, types_factory.all_types):
# Don't encode already encoded values.
- return value
- klass = types_factory.for_property(name)
- obj = klass(value)
+ obj = value
+ else:
+ klass = types_factory.for_property(name)
+ obj = klass(value)
if parameters:
- if isinstance(parameters, dict):
- params = Parameters()
- for key, item in parameters.items():
- params[key] = item
- parameters = params
- assert isinstance(parameters, Parameters)
- obj.params = parameters
+ if not hasattr(obj, "params"):
+ obj.params = Parameters()
+ for key, item in parameters.items():
+ if item is None:
+ if key in obj.params:
+ del obj.params[key]
+ else:
+ obj.params[key] = item
return obj
def add(self, name, value, parameters=None, encode=1):
| collective/icalendar | 4d6aacb1c9416165b5d3c38df00fa5414222700b | diff --git a/src/icalendar/tests/test_issue_557_encode_native_parameters.py b/src/icalendar/tests/test_issue_557_encode_native_parameters.py
new file mode 100644
index 0000000..99d9f05
--- /dev/null
+++ b/src/icalendar/tests/test_issue_557_encode_native_parameters.py
@@ -0,0 +1,152 @@
+"""These are tests for Issue #557
+
+TL;DR: Component._encode lost given parameters
+if the object to encode was already of native type,
+making its behavior unexpected.
+
+see https://github.com/collective/icalendar/issues/557"""
+
+
+import unittest
+
+from icalendar.cal import Component
+
+
+class TestComponentEncode(unittest.TestCase):
+ def test_encode_non_native_parameters(self):
+ """Test _encode to add parameters to non-natives"""
+ self.__assert_native_content(self.summary)
+ self.__assert_native_kept_parameters(self.summary)
+
+ def test_encode_native_keep_params_None(self):
+ """_encode should keep parameters on natives
+ if parameters=None
+ """
+ new_sum = self.__add_params(
+ self.summary,
+ parameters=None,
+ )
+ self.__assert_native_content(new_sum)
+ self.__assert_native_kept_parameters(new_sum)
+
+ def test_encode_native_keep_params_empty(self):
+ """_encode should keep paramters on natives
+ if parameters={}
+ """
+ new_sum = self.__add_params(
+ self.summary,
+ parameters={},
+ )
+ self.__assert_native_content(new_sum)
+ self.__assert_native_kept_parameters(new_sum)
+
+ def test_encode_native_append_params(self):
+ """_encode should append paramters on natives
+ keeping old parameters
+ """
+ new_sum = self.__add_params(
+ self.summary,
+ parameters={"X-PARAM": "Test123"},
+ )
+ self.__assert_native_content(new_sum)
+ self.__assert_native_kept_parameters(new_sum)
+ self.assertParameter(new_sum, "X-PARAM", "Test123")
+
+ def test_encode_native_overwrite_params(self):
+ """_encode should overwrite single parameters
+ if they have the same name as old ones"""
+ new_sum = self.__add_params(
+ self.summary,
+ parameters={"LANGUAGE": "de"},
+ )
+ self.__assert_native_content(new_sum)
+ self.assertParameter(new_sum, "LANGUAGE", "de")
+
+ def test_encode_native_remove_params(self):
+ """_encode should remove single parameters
+ if they are explicitly set to None"""
+ new_sum = self.__add_params(
+ self.summary,
+ parameters={"LANGUAGE": None},
+ )
+ self.__assert_native_content(new_sum)
+ self.assertParameterMissing(new_sum, "LANGUAGE")
+
+ def test_encode_native_remove_already_missing(self):
+ """_encode should ignore removing a parameter
+ that was already missing"""
+ self.assertParameterMissing(self.summary, "X-MISSING")
+ new_sum = self.__add_params(
+ self.summary,
+ parameters={"X-MISSING": None},
+ )
+ self.__assert_native_content(new_sum)
+ self.__assert_native_kept_parameters(new_sum)
+ self.assertParameterMissing(self.summary, "X-MISSING")
+
+ def test_encode_native_full_test(self):
+ """full test case with keeping, overwriting & removing properties"""
+ # preperation
+ orig_sum = self.__add_params(
+ self.summary,
+ parameters={
+ "X-OVERWRITE": "overwrite me!",
+ "X-REMOVE": "remove me!",
+ "X-MISSING": None,
+ },
+ )
+ # preperation check
+ self.__assert_native_content(orig_sum)
+ self.__assert_native_kept_parameters(orig_sum)
+ self.assertParameter(orig_sum, "X-OVERWRITE", "overwrite me!")
+ self.assertParameter(orig_sum, "X-REMOVE", "remove me!")
+ self.assertParameterMissing(orig_sum, "X-MISSING")
+ # modification
+ new_sum = self.__add_params(
+ orig_sum,
+ parameters={
+ "X-OVERWRITE": "overwritten",
+ "X-REMOVE": None,
+ "X-MISSING": None,
+ },
+ )
+ # final asserts
+ self.__assert_native_content(new_sum)
+ self.__assert_native_kept_parameters(new_sum)
+ self.assertParameter(new_sum, "X-OVERWRITE", "overwritten")
+ self.assertParameterMissing(new_sum, "X-REMOVE")
+ self.assertParameterMissing(new_sum, "X-MISSING")
+
+ def setUp(self):
+ self.summary = self.__gen_native()
+
+ def __assert_native_kept_parameters(self, obj):
+ self.assertParameter(obj, "LANGUAGE", "en")
+
+ def __assert_native_content(self, obj):
+ self.assertEqual(obj, "English Summary")
+
+ def __add_params(self, obj, parameters):
+ return Component._encode(
+ "SUMMARY",
+ obj,
+ parameters=parameters,
+ encode=True,
+ )
+
+ def __gen_native(self):
+ return Component._encode(
+ "SUMMARY",
+ "English Summary",
+ parameters={
+ "LANGUAGE": "en",
+ },
+ encode=True,
+ )
+
+ def assertParameterMissing(self, obj, name):
+ self.assertNotIn(name, obj.params)
+
+ def assertParameter(self, obj, name, val):
+ self.assertIn(name, obj.params)
+ self.assertEqual(obj.params[name], val)
| [BUG] Component._encode ignores parameters if value is native
<!-- This template is there to guide you and help us. If you can not complete everything here, that is fine. -->
## Describe the bug
<!-- A clear and concise description of what the bug is. -->
`Component._encode` ignores the given parameters if the value is already of a native type (see [code in question](https://github.com/collective/icalendar/blob/df769f88694745d3babb87457bc3080965aa62c4/src/icalendar/cal.py#L139-L141)). IMO this is unexpected behavior. This also seems unexpected for the dependent library caldav, where it leads to a RELTYPE to be fully ignored if the passed UID is of type vText (see python-caldav/caldav#334).
## To Reproduce
<!-- Please add the neccesary code here to reproduce the problem on your machine. -->
(I’m not familiar with this library as I only discovered this issue through discovering python-caldav/caldav#334, so the reproducing code is not fully complete.)
```
import icalendar
todo_1 # assume minimal working vTODO
todo_2 # assume other minimal working vTODO
todo_2.add(
"RELATES-TO",
todo_1["uid"],
parameters={"RELTYPE": "DEPENDS-ON"},
)
print(todo_2.to_ical())
```
In the output, the `RELATES-TO` is added, as specified.
However, its missing the parameter `RELTYPE=DEPENDS-ON`.
## Expected behavior
Use the specified parameters (replace or append already existing ones on the native type) or, at least, throw a warning or error that parameter will be ignored.
## Environment
<!-- please complete the following information: -->
- [x] OS: Debian GNU/Linux trixie/sid
- [x] Python version: Python 3.11.5
- [x] `icalendar` version: 5.0.8
## Additional context
<!-- Add any other context about the problem here, related issues and pull requests. -->
- [x] I tested it with the latest version `pip3 install https://github.com/collective/icalendar.git`
- [x] I attached the ICS source file or there is no ICS source file
| 0.0 | 4d6aacb1c9416165b5d3c38df00fa5414222700b | [
"src/icalendar/tests/test_issue_557_encode_native_parameters.py::TestComponentEncode::test_encode_native_append_params",
"src/icalendar/tests/test_issue_557_encode_native_parameters.py::TestComponentEncode::test_encode_native_full_test",
"src/icalendar/tests/test_issue_557_encode_native_parameters.py::TestComponentEncode::test_encode_native_keep_params_None",
"src/icalendar/tests/test_issue_557_encode_native_parameters.py::TestComponentEncode::test_encode_native_keep_params_empty",
"src/icalendar/tests/test_issue_557_encode_native_parameters.py::TestComponentEncode::test_encode_native_overwrite_params",
"src/icalendar/tests/test_issue_557_encode_native_parameters.py::TestComponentEncode::test_encode_native_remove_already_missing",
"src/icalendar/tests/test_issue_557_encode_native_parameters.py::TestComponentEncode::test_encode_native_remove_params",
"src/icalendar/tests/test_issue_557_encode_native_parameters.py::TestComponentEncode::test_encode_non_native_parameters"
]
| []
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2023-09-24 12:29:01+00:00 | bsd-2-clause | 1,644 |
|
collective__zpretty-122 | diff --git a/HISTORY.md b/HISTORY.md
index f84ba58..bd9d8e6 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -3,8 +3,9 @@
3.0.4 (unreleased)
------------------
-- Nothing changed yet.
-
+- Fix bogus ampersands in attributes
+ (Fixes #116)
+ [ale-rt]
3.0.3 (2023-03-26)
diff --git a/zpretty/prettifier.py b/zpretty/prettifier.py
index 4d7c4e5..e28e7f7 100644
--- a/zpretty/prettifier.py
+++ b/zpretty/prettifier.py
@@ -43,7 +43,17 @@ class ZPrettifier(object):
text = text.decode(self.encoding)
self.original_text = text
self.text = self._prepare_text()
- self.soup = self.get_soup(self.text)
+ soup = self.get_soup(self.text)
+ # Workaround for https://github.com/collective/zpretty/issues/116
+ # restore the ampersands
+ # in the attributes so that bogus ones can be escaped
+ for el in soup.descendants:
+ attrs = getattr(el, "attrs", {})
+ for key, value in attrs.items():
+ if self._ampersand_marker in value:
+ attrs[key] = value.replace(self._ampersand_marker, "&")
+
+ self.soup = soup
# Cleanup all spurious self._newlines_marker attributes, see #35
key = self._newlines_marker.partition("=")[0]
| collective/zpretty | b2fb219d34508875f5e3a0351b8eabb094364a0f | diff --git a/zpretty/tests/test_zpretty.py b/zpretty/tests/test_zpretty.py
index 6b3c499..016b847 100644
--- a/zpretty/tests/test_zpretty.py
+++ b/zpretty/tests/test_zpretty.py
@@ -171,6 +171,20 @@ class TestZpretty(TestCase):
def test_single_quotes_in_attrs(self):
self.assertPrettified('<root a="\'" />', '<root a="\'"></root>\n')
+ def test_ampersand_in_attrs(self):
+ self.assertPrettified('<root a="&" />', '<root a="&"></root>\n')
+ self.assertPrettified('<root a="foo &" />', '<root a="foo &"></root>\n')
+ self.assertPrettified('<root a="& bar" />', '<root a="& bar"></root>\n')
+ self.assertPrettified('<root a=";&" />', '<root a=";&"></root>\n')
+ self.assertPrettified('<root a="&;" />', '<root a="&;"></root>\n')
+
+ def test_escaped_ampersand_in_attrs(self):
+ self.assertPrettified('<root a="&" />', '<root a="&"></root>\n')
+ self.assertPrettified('<root a="foo &" />', '<root a="foo &"></root>\n')
+ self.assertPrettified('<root a="& bar" />', '<root a="& bar"></root>\n')
+ self.assertPrettified('<root a=";&" />', '<root a=";&"></root>\n')
+ self.assertPrettified('<root a="&;" />', '<root a="&;"></root>\n')
+
def test_sample_html(self):
self.prettify("sample_html.html")
| Broken reformatting at plone.schemaeditor
👋🏾 somehow when trying to format `plone.schemaeditor`'s [`schema_listing.pt`](https://github.com/plone/plone.schemaeditor/blob/master/plone/schemaeditor/browser/schema/schema_listing.pt) `zpretty` trips and produces invalid code.
Please test it with these changes: https://github.com/plone/plone.schemaeditor/pull/99
So one can run `tox -e test` to ensure that tests do run fine, then run `tox -e format` to apply `zpretty` and finally run `tox -e test` again to see that the reformatting of the template mentioned above breaks the tests.
The diff looks like this:
```diff
<tal:field tal:replace="structure widget/@@ploneform-render-widget" />
</div>
</div>
- </tal:block>
+ </a></fieldset></tal:block>
- </tal:widgets>
+
- </fieldset>
- </tal:block>
+
+
</metal:fields-slot>
</metal:form>
</div>
```
Somehow `zpretty` decides to replace `</tal:block>` and `<tal:widgets>` by a single `</a>`
@ale-rt any idea? 🍀 | 0.0 | b2fb219d34508875f5e3a0351b8eabb094364a0f | [
"zpretty/tests/test_zpretty.py::TestZpretty::test_ampersand_in_attrs"
]
| [
"zpretty/tests/test_zpretty.py::TestZpretty::test_boolean_attributes",
"zpretty/tests/test_zpretty.py::TestZpretty::test_element_repr",
"zpretty/tests/test_zpretty.py::TestZpretty::test_elements_with_new_lines",
"zpretty/tests/test_zpretty.py::TestZpretty::test_entities",
"zpretty/tests/test_zpretty.py::TestZpretty::test_escaped_ampersand_in_attrs",
"zpretty/tests/test_zpretty.py::TestZpretty::test_fix_self_closing",
"zpretty/tests/test_zpretty.py::TestZpretty::test_format_self_closing_tag",
"zpretty/tests/test_zpretty.py::TestZpretty::test_many_children",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_no_text",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_with_tail",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_with_text",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_html",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_html4",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_html_with_preprocessing_instruction",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_pt",
"zpretty/tests/test_zpretty.py::TestZpretty::test_single_quotes_in_attrs",
"zpretty/tests/test_zpretty.py::TestZpretty::test_text_close_to_an_element",
"zpretty/tests/test_zpretty.py::TestZpretty::test_text_file",
"zpretty/tests/test_zpretty.py::TestZpretty::test_text_with_markup",
"zpretty/tests/test_zpretty.py::TestZpretty::test_whitelines_not_stripped"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2023-03-27 08:32:13+00:00 | bsd-3-clause | 1,645 |
|
collective__zpretty-132 | diff --git a/HISTORY.md b/HISTORY.md
index c475ebf..64da5b9 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -2,15 +2,15 @@
## 3.1.0a2 (unreleased)
-
-- Nothing changed yet.
-
+- Improve the regular expression that matches the entities
+ (Fixes #130)
+ [ale-rt]
## 3.1.0a1 (2023-05-04)
- Add command line parameters to include/exclude files and folders
(Implements #96)
- [ale-rt]
+ [ale-rt]
- Be tolerant with characters forbidden in XML when dealing with tal attributes
(See #125)
[ale-rt]
diff --git a/zpretty/prettifier.py b/zpretty/prettifier.py
index e28e7f7..9d0a15e 100644
--- a/zpretty/prettifier.py
+++ b/zpretty/prettifier.py
@@ -81,12 +81,16 @@ class ZPrettifier(object):
# Get all the entities in the text and replace them with a marker
# The text might contain undefined entities that BeautifulSoup
# will strip out.
- entities = set(re.findall(r"&[^;]+;", text))
- for entitiy in entities:
+ entities = {
+ _[0]
+ for _ in re.findall(
+ r"(&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});)", text, re.IGNORECASE
+ )
+ }
+ for entity in entities:
marker = str(uuid4())
- self._entity_mapping[entitiy] = marker
- text = text.replace(entitiy, marker)
-
+ self._entity_mapping[entity] = marker
+ text = text.replace(entity, marker)
return "\n".join(
line if line.strip() else self._newlines_marker
for line in text.splitlines()
| collective/zpretty | f1b639eebbf350aae4494c1f16edde450b41295c | diff --git a/zpretty/tests/test_zpretty.py b/zpretty/tests/test_zpretty.py
index 016b847..92b6ee2 100644
--- a/zpretty/tests/test_zpretty.py
+++ b/zpretty/tests/test_zpretty.py
@@ -185,6 +185,12 @@ class TestZpretty(TestCase):
self.assertPrettified('<root a=";&" />', '<root a=";&"></root>\n')
self.assertPrettified('<root a="&;" />', '<root a="&;"></root>\n')
+ def test_ampersand_and_column_in_separate_attrs(self):
+ self.assertPrettified(
+ '<foo a="&" />\n<tal:bar b=";" />',
+ '<foo a="&"></foo>\n<tal:bar b=";" />\n',
+ )
+
def test_sample_html(self):
self.prettify("sample_html.html")
| problem in combination of "&" and ";" in attributes.
Affects: zpretty 3.1.0a1
## problem 1
Running `zpretty` without any options on this input:
```
<a href="a=b&c=d"></a>
<div tal:define="var view/attr;"></div>
```
Produces this output:
```
<a href="a=b&c=d"></a>
<div tal:define="var view/attr;"></a>
```
Or with even more stripped down input:
```
<a attr="&"></a>
<div attr=";"></div>
```
produces:
```
<a attr="&"></a>
<div attr=";"></a>
```
## problem 2
This input:
```
<a tal:attributes="href python:'&';"></a>
```
Produces this output:
```
<a tal:attributes="
href python:'&';;
"></a>
```
There is an extra semicolon which shouldn't be there.
| 0.0 | f1b639eebbf350aae4494c1f16edde450b41295c | [
"zpretty/tests/test_zpretty.py::TestZpretty::test_ampersand_and_column_in_separate_attrs"
]
| [
"zpretty/tests/test_zpretty.py::TestZpretty::test_ampersand_in_attrs",
"zpretty/tests/test_zpretty.py::TestZpretty::test_boolean_attributes",
"zpretty/tests/test_zpretty.py::TestZpretty::test_element_repr",
"zpretty/tests/test_zpretty.py::TestZpretty::test_elements_with_new_lines",
"zpretty/tests/test_zpretty.py::TestZpretty::test_entities",
"zpretty/tests/test_zpretty.py::TestZpretty::test_escaped_ampersand_in_attrs",
"zpretty/tests/test_zpretty.py::TestZpretty::test_fix_self_closing",
"zpretty/tests/test_zpretty.py::TestZpretty::test_format_self_closing_tag",
"zpretty/tests/test_zpretty.py::TestZpretty::test_many_children",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_no_text",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_with_tail",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_with_text",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_html",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_html4",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_html_with_preprocessing_instruction",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_pt",
"zpretty/tests/test_zpretty.py::TestZpretty::test_single_quotes_in_attrs",
"zpretty/tests/test_zpretty.py::TestZpretty::test_text_close_to_an_element",
"zpretty/tests/test_zpretty.py::TestZpretty::test_text_file",
"zpretty/tests/test_zpretty.py::TestZpretty::test_text_with_markup",
"zpretty/tests/test_zpretty.py::TestZpretty::test_whitelines_not_stripped"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2023-05-09 16:04:45+00:00 | bsd-3-clause | 1,646 |
|
collective__zpretty-36 | diff --git a/HISTORY.md b/HISTORY.md
index b796720..b7935f6 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -3,6 +3,7 @@
2.1.0 (unreleased)
------------------
+- Do not render a spurious `=""` when new lines appear inside a tag (Refs. #35) [ale-rt]
- The attributes renderer knows about the element indentation
and for indents the attributes consequently [ale-rt]
- The ZCML element has now its custom tag templates, this simplifies the code [ale-rt]
diff --git a/zpretty/prettifier.py b/zpretty/prettifier.py
index 3e6cf5a..4468653 100644
--- a/zpretty/prettifier.py
+++ b/zpretty/prettifier.py
@@ -33,6 +33,11 @@ class ZPrettifier(object):
for line in text.splitlines()
)
self.soup = self.get_soup(self.text)
+
+ # Cleanup all spurious self._newlines_marker attributes, see #35
+ for el in self.soup.find_all(attrs={self._newlines_marker: ""}):
+ el.attrs.pop(self._newlines_marker, None)
+
self.root = self.pretty_element(self.soup, -1)
def get_soup(self, text):
| collective/zpretty | 78402172b55d68f4d9ee4df341a0652891c83264 | diff --git a/zpretty/tests/test_zpretty.py b/zpretty/tests/test_zpretty.py
index 0db7440..17eb548 100644
--- a/zpretty/tests/test_zpretty.py
+++ b/zpretty/tests/test_zpretty.py
@@ -152,6 +152,17 @@ class TestZpretty(TestCase):
"<root>\n (<a></a>)\n</root>", "<root>\n (<a></a>)\n</root>\n"
)
+ def test_elements_with_new_lines(self):
+ self.assertPrettified("<root\n></root>", "<root></root>\n")
+ self.assertPrettified(
+ '<root\na="b"\n\n></root>',
+ ('<root a="b"></root>\n'),
+ )
+ self.assertPrettified(
+ '<root\na="b"\n\nc="d"></root>',
+ ('<root a="b"\n c="d"\n></root>\n'),
+ )
+
def test_entities(self):
self.assertPrettified("<root> </root>", "<root> </root>\n")
| empty lines in tag lead to invalid attributes
when test.html is
```
<select id="workflow_action"
name="workflow_action"
></select>
```
then ``$ zpretty test.html`` produces this output:
```
<select id="workflow_action"
=""
name="workflow_action"
></select>
```
Or general test.html:
```
<tag attr="ok"
></tag>
```
leads to:
```
<tag =""
attr="ok"
></tag>
``` | 0.0 | 78402172b55d68f4d9ee4df341a0652891c83264 | [
"zpretty/tests/test_zpretty.py::TestZpretty::test_elements_with_new_lines"
]
| [
"zpretty/tests/test_zpretty.py::TestZpretty::test_boolean_attributes",
"zpretty/tests/test_zpretty.py::TestZpretty::test_element_repr",
"zpretty/tests/test_zpretty.py::TestZpretty::test_entities",
"zpretty/tests/test_zpretty.py::TestZpretty::test_fix_self_closing",
"zpretty/tests/test_zpretty.py::TestZpretty::test_format_self_closing_tag",
"zpretty/tests/test_zpretty.py::TestZpretty::test_many_children",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_no_text",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_with_tail",
"zpretty/tests/test_zpretty.py::TestZpretty::test_nesting_with_text",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_html",
"zpretty/tests/test_zpretty.py::TestZpretty::test_sample_pt",
"zpretty/tests/test_zpretty.py::TestZpretty::test_single_quotes_in_attrs",
"zpretty/tests/test_zpretty.py::TestZpretty::test_text_close_to_an_element",
"zpretty/tests/test_zpretty.py::TestZpretty::test_text_with_markup",
"zpretty/tests/test_zpretty.py::TestZpretty::test_whitelines_not_stripped"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-01-30 17:35:40+00:00 | bsd-3-clause | 1,647 |
|
colour-science__flask-compress-14 | diff --git a/README.md b/README.md
index 270ab6a..f8560c2 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,8 @@ $ easy_install flask-compress
## Using Flask-Compress
+### Globally
+
Flask-Compress is incredibly simple to use. In order to start compressing your Flask application's assets, the first thing to do is let Flask-Compress know about your [`flask.Flask`](http://flask.pocoo.org/docs/latest/api/#flask.Flask) application object.
```python
@@ -75,6 +77,25 @@ def start_app():
In terms of automatically compressing your assets, passing your [`flask.Flask`](http://flask.pocoo.org/docs/latest/api/#flask.Flask) object to the `flask_compress.Compress` object is all that needs to be done.
+### Per-view compression
+
+Compression is possible per view using the `@compress.compressed()` decorator. Make sure to disable global compression first.
+
+```python
+from flask import Flask
+from flask_compress import Compress
+
+app = Flask(__name__)
+app.config["COMPRESS_REGISTER"] = False # disable default compression of all eligible requests
+compress = Compress()
+compress.init_app(app)
+
+# Compress this view specifically
[email protected]("/test")
[email protected]()
+def view():
+ pass
+```
## Options
diff --git a/flask_compress.py b/flask_compress.py
index 9770dda..38cca65 100644
--- a/flask_compress.py
+++ b/flask_compress.py
@@ -4,6 +4,7 @@
# License: The MIT License (MIT)
import sys
+import functools
from gzip import GzipFile
import zlib
from io import BytesIO
@@ -11,7 +12,7 @@ from io import BytesIO
from collections import defaultdict
import brotli
-from flask import request, current_app
+from flask import request, after_this_request, current_app
if sys.version_info[:2] == (2, 6):
@@ -196,6 +197,17 @@ class Compress(object):
return response
+ def compressed(self):
+ def decorator(f):
+ @functools.wraps(f)
+ def decorated_function(*args, **kwargs):
+ @after_this_request
+ def compressor(response):
+ return self.after_request(response)
+ return f(*args, **kwargs)
+ return decorated_function
+ return decorator
+
def compress(self, app, response, algorithm):
if algorithm == 'gzip':
gzip_buffer = BytesIO()
| colour-science/flask-compress | 262c401e4a5d8652e30e807cd391857426c8a59a | diff --git a/tests/test_flask_compress.py b/tests/test_flask_compress.py
index 287118a..fca0c41 100644
--- a/tests/test_flask_compress.py
+++ b/tests/test_flask_compress.py
@@ -297,5 +297,36 @@ class CompressionAlgoTests(unittest.TestCase):
self.assertEqual(response_deflate.headers.get('Content-Encoding'), 'deflate')
+class CompressionPerViewTests(unittest.TestCase):
+ def setUp(self):
+ self.app = Flask(__name__)
+ self.app.testing = True
+ self.app.config["COMPRESS_REGISTER"] = False
+ compress = Compress()
+ compress.init_app(self.app)
+
+ @self.app.route('/route1/')
+ def view_1():
+ return render_template('large.html')
+
+ @self.app.route('/route2/')
+ @compress.compressed()
+ def view_2():
+ return render_template('large.html')
+
+ def test_compression(self):
+ client = self.app.test_client()
+ headers = [('Accept-Encoding', 'deflate')]
+
+ response = client.get('/route1/', headers=headers)
+ self.assertEqual(response.status_code, 200)
+ self.assertNotIn('Content-Encoding', response.headers)
+
+ response = client.get('/route2/', headers=headers)
+ self.assertEqual(response.status_code, 200)
+ self.assertIn('Content-Encoding', response.headers)
+ self.assertEqual(response.headers.get('Content-Encoding'), 'deflate')
+
+
if __name__ == '__main__':
unittest.main()
| Enable compression per view
Hello,
It would be fantastic if this design only allows compression to be enabled for selected views. This could be done with a decorator.
https://github.com/apache/airflow/blob/master/airflow/www/decorators.py#L67
This will allow this library to be used in my project - Apache Airflow.
Yours faithfully. | 0.0 | 262c401e4a5d8652e30e807cd391857426c8a59a | [
"tests/test_flask_compress.py::CompressionPerViewTests::test_compression"
]
| [
"tests/test_flask_compress.py::DefaultsTest::test_algorithm_default",
"tests/test_flask_compress.py::DefaultsTest::test_block_size_default",
"tests/test_flask_compress.py::DefaultsTest::test_default_deflate_settings",
"tests/test_flask_compress.py::DefaultsTest::test_level_default",
"tests/test_flask_compress.py::DefaultsTest::test_mimetypes_default",
"tests/test_flask_compress.py::DefaultsTest::test_min_size_default",
"tests/test_flask_compress.py::DefaultsTest::test_mode_default",
"tests/test_flask_compress.py::DefaultsTest::test_quality_level_default",
"tests/test_flask_compress.py::DefaultsTest::test_window_size_default",
"tests/test_flask_compress.py::InitTests::test_constructor_init",
"tests/test_flask_compress.py::InitTests::test_delayed_init",
"tests/test_flask_compress.py::UrlTests::test_br_algorithm",
"tests/test_flask_compress.py::UrlTests::test_br_compression_level",
"tests/test_flask_compress.py::UrlTests::test_compress_min_size",
"tests/test_flask_compress.py::UrlTests::test_content_length_options",
"tests/test_flask_compress.py::UrlTests::test_deflate_compression_level",
"tests/test_flask_compress.py::UrlTests::test_gzip_compression_level",
"tests/test_flask_compress.py::UrlTests::test_mimetype_mismatch",
"tests/test_flask_compress.py::CompressionAlgoTests::test_content_encoding_is_correct",
"tests/test_flask_compress.py::CompressionAlgoTests::test_default_quality_is_1",
"tests/test_flask_compress.py::CompressionAlgoTests::test_default_wildcard_quality_is_0",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_supported",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_unsupported",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_with_different_quality",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_with_equal_quality",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_with_wildcard",
"tests/test_flask_compress.py::CompressionAlgoTests::test_one_algo_supported",
"tests/test_flask_compress.py::CompressionAlgoTests::test_one_algo_unsupported",
"tests/test_flask_compress.py::CompressionAlgoTests::test_setting_compress_algorithm_cs_string",
"tests/test_flask_compress.py::CompressionAlgoTests::test_setting_compress_algorithm_list",
"tests/test_flask_compress.py::CompressionAlgoTests::test_setting_compress_algorithm_simple_string"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-10-19 14:47:18+00:00 | mit | 1,648 |
|
colour-science__flask-compress-36 | diff --git a/.gitignore b/.gitignore
index a57a25f..715ed9a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
*.sw[klmnop]
# python
*.py[co~]
+.python-version
# Ignoring build dir
/build
/dist
diff --git a/README.md b/README.md
index 842b52e..4265ceb 100644
--- a/README.md
+++ b/README.md
@@ -114,3 +114,4 @@ Within your Flask application's settings you can provide the following settings
| `COMPRESS_CACHE_BACKEND` | Specified the backend for storing the cached response data. | `None` |
| `COMPRESS_REGISTER` | Specifies if compression should be automatically registered. | `True` |
| `COMPRESS_ALGORITHM` | Supported compression algorithms. | `['br', 'gzip', 'deflate']` |
+| `COMPRESS_STREAMS` | Compress content streams. | `True` |
diff --git a/flask_compress/flask_compress.py b/flask_compress/flask_compress.py
index 8f01287..b1bbc0f 100644
--- a/flask_compress/flask_compress.py
+++ b/flask_compress/flask_compress.py
@@ -77,6 +77,7 @@ class Compress(object):
('COMPRESS_CACHE_KEY', None),
('COMPRESS_CACHE_BACKEND', None),
('COMPRESS_REGISTER', True),
+ ('COMPRESS_STREAMS', True),
('COMPRESS_ALGORITHM', ['br', 'gzip', 'deflate']),
]
@@ -178,7 +179,7 @@ class Compress(object):
response.mimetype not in app.config["COMPRESS_MIMETYPES"] or
response.status_code < 200 or
response.status_code >= 300 or
- response.is_streamed or
+ (response.is_streamed and app.config["COMPRESS_STREAMS"] is False)or
"Content-Encoding" in response.headers or
(response.content_length is not None and
response.content_length < app.config["COMPRESS_MIN_SIZE"])):
| colour-science/flask-compress | 8bc891203c611b14fffbfec155df226c9955d954 | diff --git a/tests/test_flask_compress.py b/tests/test_flask_compress.py
index 84a8d75..04e1051 100644
--- a/tests/test_flask_compress.py
+++ b/tests/test_flask_compress.py
@@ -51,6 +51,10 @@ class DefaultsTest(unittest.TestCase):
""" Tests COMPRESS_BR_BLOCK default value is correctly set. """
self.assertEqual(self.app.config['COMPRESS_BR_BLOCK'], 0)
+ def test_stream(self):
+ """ Tests COMPRESS_STREAMS default value is correctly set. """
+ self.assertEqual(self.app.config['COMPRESS_STREAMS'], True)
+
class InitTests(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
@@ -353,13 +357,12 @@ class StreamTests(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
self.app.testing = True
+ self.app.config["COMPRESS_STREAMS"] = False
self.file_path = os.path.join(os.getcwd(), 'tests', 'templates',
'large.html')
self.file_size = os.path.getsize(self.file_path)
- Compress(self.app)
-
@self.app.route('/stream/large')
def stream():
def _stream():
@@ -370,6 +373,7 @@ class StreamTests(unittest.TestCase):
def test_no_compression_stream(self):
""" Tests compression is skipped when response is streamed"""
+ Compress(self.app)
client = self.app.test_client()
for algorithm in ('gzip', 'deflate', 'br', ''):
headers = [('Accept-Encoding', algorithm)]
@@ -378,6 +382,17 @@ class StreamTests(unittest.TestCase):
self.assertEqual(response.is_streamed, True)
self.assertEqual(self.file_size, len(response.data))
+ def test_disabled_stream(self):
+ """Test that stream compression can be disabled."""
+ Compress(self.app)
+ self.app.config["COMPRESS_STREAMS"] = True
+ client = self.app.test_client()
+ for algorithm in ('gzip', 'deflate', 'br'):
+ headers = [('Accept-Encoding', algorithm)]
+ response = client.get('/stream/large', headers=headers)
+ self.assertIn('Content-Encoding', response.headers)
+ self.assertGreater(self.file_size, len(response.data))
+
if __name__ == '__main__':
unittest.main()
| gzip not work with v1.12
I am not sure what happened.
The gzip compress of my website works fine in `v1.11`.
However, in `v1.12` all files are uncompressed.
My usecase is basic as follows, where my static files locate in `/web` directory.
```
app = Flask(__name__, static_folder='web', static_url_path='')
app.config['COMPRESS_MIMETYPES'] = ['text/html', 'text/css', 'text/xml',
'application/json',
'application/javascript', 'font/ttf', 'font/otf', 'application/octet-stream']
Compress(app)
``` | 0.0 | 8bc891203c611b14fffbfec155df226c9955d954 | [
"tests/test_flask_compress.py::DefaultsTest::test_stream",
"tests/test_flask_compress.py::StreamTests::test_disabled_stream"
]
| [
"tests/test_flask_compress.py::DefaultsTest::test_algorithm_default",
"tests/test_flask_compress.py::DefaultsTest::test_block_size_default",
"tests/test_flask_compress.py::DefaultsTest::test_default_deflate_settings",
"tests/test_flask_compress.py::DefaultsTest::test_level_default",
"tests/test_flask_compress.py::DefaultsTest::test_mimetypes_default",
"tests/test_flask_compress.py::DefaultsTest::test_min_size_default",
"tests/test_flask_compress.py::DefaultsTest::test_mode_default",
"tests/test_flask_compress.py::DefaultsTest::test_quality_level_default",
"tests/test_flask_compress.py::DefaultsTest::test_window_size_default",
"tests/test_flask_compress.py::InitTests::test_constructor_init",
"tests/test_flask_compress.py::InitTests::test_delayed_init",
"tests/test_flask_compress.py::UrlTests::test_br_algorithm",
"tests/test_flask_compress.py::UrlTests::test_br_compression_level",
"tests/test_flask_compress.py::UrlTests::test_compress_min_size",
"tests/test_flask_compress.py::UrlTests::test_content_length_options",
"tests/test_flask_compress.py::UrlTests::test_deflate_compression_level",
"tests/test_flask_compress.py::UrlTests::test_gzip_compression_level",
"tests/test_flask_compress.py::UrlTests::test_mimetype_mismatch",
"tests/test_flask_compress.py::CompressionAlgoTests::test_chrome_ranged_requests",
"tests/test_flask_compress.py::CompressionAlgoTests::test_content_encoding_is_correct",
"tests/test_flask_compress.py::CompressionAlgoTests::test_default_quality_is_1",
"tests/test_flask_compress.py::CompressionAlgoTests::test_default_wildcard_quality_is_0",
"tests/test_flask_compress.py::CompressionAlgoTests::test_identity",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_supported",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_unsupported",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_with_different_quality",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_with_equal_quality",
"tests/test_flask_compress.py::CompressionAlgoTests::test_multiple_algos_with_wildcard",
"tests/test_flask_compress.py::CompressionAlgoTests::test_one_algo_supported",
"tests/test_flask_compress.py::CompressionAlgoTests::test_one_algo_unsupported",
"tests/test_flask_compress.py::CompressionAlgoTests::test_setting_compress_algorithm_cs_string",
"tests/test_flask_compress.py::CompressionAlgoTests::test_setting_compress_algorithm_list",
"tests/test_flask_compress.py::CompressionAlgoTests::test_setting_compress_algorithm_simple_string",
"tests/test_flask_compress.py::CompressionAlgoTests::test_wildcard_quality",
"tests/test_flask_compress.py::CompressionPerViewTests::test_compression",
"tests/test_flask_compress.py::StreamTests::test_no_compression_stream"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-09-21 12:28:33+00:00 | mit | 1,649 |
|
comic__evalutils-300 | diff --git a/evalutils/cli.py b/evalutils/cli.py
index fb8ce4d..7c160d9 100644
--- a/evalutils/cli.py
+++ b/evalutils/cli.py
@@ -1,5 +1,6 @@
import re
from pathlib import Path
+from typing import List
import click
from cookiecutter.exceptions import FailedHookException
@@ -39,6 +40,30 @@ def validate_python_module_name_fn(option):
return validate_python_module_name_string
+class AbbreviatedChoice(click.Choice):
+ def __init__(self, choices: List[str]):
+ super().__init__(choices=choices, case_sensitive=True)
+ self._abbreviations = [e[0].upper() for e in choices]
+ self._choices_upper = list(map(str.upper, choices))
+ if len(set(self._abbreviations)) != len(choices):
+ raise ValueError(
+ "First letters of choices for AbbreviatedChoices should be unique!"
+ )
+
+ def get_metavar(self, param):
+ return "[{}]".format(
+ "|".join([f"({e[0]}){e[1:]}" for e in self.choices])
+ )
+
+ def convert(self, value, param, ctx):
+ value = value.upper()
+ if value in self._abbreviations:
+ value = self.choices[self._abbreviations.index(value)]
+ elif value in self._choices_upper:
+ value = self.choices[self._choices_upper.index(value)]
+ return super().convert(value=value, param=param, ctx=ctx)
+
+
@init.command(
name="evaluation", short_help="Initialise an evaluation project."
)
@@ -47,8 +72,8 @@ def validate_python_module_name_fn(option):
)
@click.option(
"--kind",
- type=click.Choice(EVALUATION_CHOICES),
- prompt=f"What kind of challenge is this? [{'|'.join(EVALUATION_CHOICES)}]",
+ type=AbbreviatedChoice(EVALUATION_CHOICES),
+ prompt=f"What kind of challenge is this?",
)
@click.option("--dev", is_flag=True)
def init_evaluation(challenge_name, kind, dev):
@@ -137,8 +162,8 @@ def req_gpu_prompt(ctx, param, req_gpu_count):
)
@click.option(
"--kind",
- type=click.Choice(ALGORITHM_CHOICES),
- prompt=f"What kind of algorithm is this? [{'|'.join(ALGORITHM_CHOICES)}]",
+ type=AbbreviatedChoice(ALGORITHM_CHOICES),
+ prompt=f"What kind of algorithm is this?",
)
@click.option("--diag-ticket", type=click.STRING, default="")
@click.option(
| comic/evalutils | 35d8680f7107230f5b9c4403dd3e7368b1288440 | diff --git a/tests/test_abbreviatedchoice.py b/tests/test_abbreviatedchoice.py
new file mode 100644
index 0000000..21a582c
--- /dev/null
+++ b/tests/test_abbreviatedchoice.py
@@ -0,0 +1,26 @@
+import pytest
+
+from evalutils.cli import AbbreviatedChoice
+
+
+def test_abbreviated_choice_not_unique():
+ with pytest.raises(ValueError):
+ AbbreviatedChoice(choices=["Same", "same", "other"])
+
+
[email protected](
+ "value, expected",
+ (
+ ("s", "same"),
+ ("S", "same"),
+ ("Same", "same"),
+ ("same", "same"),
+ ("other", "oTHER"),
+ ("O", "oTHER"),
+ ("o", "oTHER"),
+ ("OtHER", "oTHER"),
+ ),
+)
+def test_abbreviated_choice_convert(value: str, expected: str):
+ ac = AbbreviatedChoice(choices=["same", "oTHER"])
+ assert ac.convert(value=value, param=None, ctx=None) == expected
| Allow abbreviations for picking the templates
### Description
Evalutils allows you to pick a template using --kind or by entering it in the terminal. These option strings [Classification|Segmentation|Detection] need to be fully typed, but can be abbreviated. [C,S,B].
### What I Did
```
python -m evalutils init algorithm|evaluation myproject
```
| 0.0 | 35d8680f7107230f5b9c4403dd3e7368b1288440 | [
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_not_unique",
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_convert[s-same]",
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_convert[S-same]",
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_convert[Same-same]",
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_convert[same-same]",
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_convert[other-oTHER]",
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_convert[O-oTHER]",
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_convert[o-oTHER]",
"tests/test_abbreviatedchoice.py::test_abbreviated_choice_convert[OtHER-oTHER]"
]
| []
| {
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2021-02-22 22:10:23+00:00 | mit | 1,650 |
|
comic__evalutils-55 | diff --git a/evalutils/evalutils.py b/evalutils/evalutils.py
index b2663b0..e18b6dd 100644
--- a/evalutils/evalutils.py
+++ b/evalutils/evalutils.py
@@ -9,9 +9,9 @@ from warnings import warn
from pandas import DataFrame, merge, Series, concat
-from evalutils.utils import score_detection
from .exceptions import FileLoaderError, ValidationError, ConfigurationError
from .io import first_int_in_filename_key, FileLoader, CSVLoader
+from .scorers import score_detection
from .validators import DataFrameValidator
logger = logging.getLogger(__name__)
diff --git a/evalutils/utils.py b/evalutils/scorers.py
similarity index 100%
rename from evalutils/utils.py
rename to evalutils/scorers.py
diff --git a/evalutils/template/hooks/post_gen_project.py b/evalutils/template/hooks/post_gen_project.py
index cb52c5f..bb902c3 100644
--- a/evalutils/template/hooks/post_gen_project.py
+++ b/evalutils/template/hooks/post_gen_project.py
@@ -3,12 +3,16 @@ import os
import shutil
from pathlib import Path
-templated_python_files = Path(os.getcwd()).glob('*.py.j2')
+CHALLENGE_KIND = "{{ cookiecutter.challenge_kind }}"
+
+EOL_UNIX = b"\n"
+EOL_WIN = b"\r\n"
+EOL_MAC = b"\r"
+
+templated_python_files = Path(os.getcwd()).glob("*.py.j2")
for f in templated_python_files:
shutil.move(f.name, f.stem)
-challenge_kind = "{{ cookiecutter.challenge_kind }}"
-
def remove_classification_files():
os.remove(Path("ground-truth") / "reference.csv")
@@ -29,11 +33,38 @@ def remove_detection_files():
os.remove(Path("test") / "detection-submission.csv")
-if challenge_kind.lower() != "segmentation":
+if CHALLENGE_KIND.lower() != "segmentation":
remove_segmentation_files()
-if challenge_kind.lower() != "detection":
+if CHALLENGE_KIND.lower() != "detection":
remove_detection_files()
-if challenge_kind.lower() != "classification":
+if CHALLENGE_KIND.lower() != "classification":
remove_classification_files()
+
+
+def convert_line_endings():
+ """ Enforce unix line endings for the generated files """
+ files = []
+ for ext in [
+ ".py",
+ ".sh",
+ "Dockerfile",
+ ".txt",
+ ".csv",
+ ".mhd",
+ ".gitignore",
+ ]:
+ files.extend(Path(".").glob(f"**/*{ext}"))
+
+ for file in files:
+ with open(file, "rb") as f:
+ lines = f.read()
+
+ lines = lines.replace(EOL_WIN, EOL_UNIX).replace(EOL_MAC, EOL_UNIX)
+
+ with open(file, "wb") as f:
+ f.write(lines)
+
+
+convert_line_endings()
diff --git a/evalutils/template/{{ cookiecutter.package_name }}/.gitignore b/evalutils/template/{{ cookiecutter.package_name }}/.gitignore
new file mode 100644
index 0000000..13f175c
--- /dev/null
+++ b/evalutils/template/{{ cookiecutter.package_name }}/.gitignore
@@ -0,0 +1,105 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# dotenv
+.env
+
+# virtualenv
+.venv
+venv/
+ENV/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+
+# Pycharm
+.idea/
| comic/evalutils | 1a45831e80ac61093b07e3a5068ed352f2331e3e | diff --git a/tests/test_utils.py b/tests/test_utils.py
index 22791e2..ba90d2d 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -1,7 +1,7 @@
from csv import DictReader
from pathlib import Path
-from evalutils.utils import find_hits_for_targets, score_detection
+from evalutils.scorers import find_hits_for_targets, score_detection
def load_points_csv(filepath):
| Generating the project template under windows results in windows line endings | 0.0 | 1a45831e80ac61093b07e3a5068ed352f2331e3e | [
"tests/test_utils.py::test_point_merging",
"tests/test_utils.py::test_find_hits",
"tests/test_utils.py::test_score_detection",
"tests/test_utils.py::test_multi_hit"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2018-09-12 08:31:46+00:00 | mit | 1,651 |
|
commitizen-tools__commitizen-497 | diff --git a/commitizen/commands/check.py b/commitizen/commands/check.py
index fb79e805..eed3ffbb 100644
--- a/commitizen/commands/check.py
+++ b/commitizen/commands/check.py
@@ -82,20 +82,18 @@ class Check:
out.success("Commit validation: successful!")
def _get_commits(self):
+ msg = None
# Get commit message from file (--commit-msg-file)
if self.commit_msg_file is not None:
# Enter this branch if commit_msg_file is "".
with open(self.commit_msg_file, "r", encoding="utf-8") as commit_file:
msg = commit_file.read()
- msg = self._filter_comments(msg)
- msg = msg.lstrip("\n")
- commit_title = msg.split("\n")[0]
- commit_body = "\n".join(msg.split("\n")[1:])
- return [git.GitCommit(rev="", title=commit_title, body=commit_body)]
+ # Get commit message from command line (--message)
elif self.commit_msg is not None:
- # Enter this branch if commit_msg is "".
- self.commit_msg = self._filter_comments(self.commit_msg)
- return [git.GitCommit(rev="", title="", body=self.commit_msg)]
+ msg = self.commit_msg
+ if msg is not None:
+ msg = self._filter_comments(msg)
+ return [git.GitCommit(rev="", title="", body=msg)]
# Get commit messages from git log (--rev-range)
return git.get_commits(end=self.rev_range)
diff --git a/commitizen/cz/conventional_commits/conventional_commits.py b/commitizen/cz/conventional_commits/conventional_commits.py
index 285f2c14..7989a171 100644
--- a/commitizen/cz/conventional_commits/conventional_commits.py
+++ b/commitizen/cz/conventional_commits/conventional_commits.py
@@ -191,8 +191,11 @@ class ConventionalCommitsCz(BaseCommitizen):
def schema_pattern(self) -> str:
PATTERN = (
- r"(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)"
- r"(\(\S+\))?!?:(\s.*)"
+ r"(?s)" # To explictly make . match new line
+ r"(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)" # type
+ r"(\(\S+\))?!?:" # scope
+ r"( [^\n\r]+)" # subject
+ r"((\n\n.*)|(\s*))?$"
)
return PATTERN
| commitizen-tools/commitizen | 2be6c41f33fe28e9e784c87fec23bb9f6246a3f9 | diff --git a/tests/commands/test_check_command.py b/tests/commands/test_check_command.py
index e5f62d0a..6fbbf322 100644
--- a/tests/commands/test_check_command.py
+++ b/tests/commands/test_check_command.py
@@ -17,20 +17,20 @@ COMMIT_LOG = [
"refactor(git): remove unnecessary dot between git range",
"bump: version 1.16.3 → 1.16.4",
(
- "Merge pull request #139 from Lee-W/fix-init-clean-config-file\n"
+ "Merge pull request #139 from Lee-W/fix-init-clean-config-file\n\n"
"Fix init clean config file"
),
"ci(pyproject.toml): add configuration for coverage",
- "fix(commands/init): fix clean up file when initialize commitizen config\n#138",
+ "fix(commands/init): fix clean up file when initialize commitizen config\n\n#138",
"refactor(defaults): split config files into long term support and deprecated ones",
"bump: version 1.16.2 → 1.16.3",
(
- "Merge pull request #136 from Lee-W/remove-redundant-readme\n"
+ "Merge pull request #136 from Lee-W/remove-redundant-readme\n\n"
"Remove redundant readme"
),
"fix: replace README.rst with docs/README.md in config files",
(
- "refactor(docs): remove README.rst and use docs/README.md\n"
+ "refactor(docs): remove README.rst and use docs/README.md\n\n"
"By removing README.rst, we no longer need to maintain "
"two document with almost the same content\n"
"Github can read docs/README.md as README for the project."
@@ -38,10 +38,10 @@ COMMIT_LOG = [
"docs(check): pin pre-commit to v1.16.2",
"docs(check): fix pre-commit setup",
"bump: version 1.16.1 → 1.16.2",
- "Merge pull request #135 from Lee-W/fix-pre-commit-hook\nFix pre commit hook",
+ "Merge pull request #135 from Lee-W/fix-pre-commit-hook\n\nFix pre commit hook",
"docs(check): enforce cz check only whem committing",
(
- 'Revert "fix(pre-commit): set pre-commit check stage to commit-msg"\n'
+ 'Revert "fix(pre-commit): set pre-commit check stage to commit-msg"\n\n'
"This reverts commit afc70133e4a81344928561fbf3bb20738dfc8a0b."
),
"feat!: add user stuff",
@@ -129,6 +129,11 @@ def test_check_conventional_commit_succeeds(mocker, capsys):
(
"feat!(lang): removed polish language",
"no conventional commit",
+ (
+ "ci: check commit message on merge\n"
+ "testing with more complex commit mes\n\n"
+ "age with error"
+ ),
),
)
def test_check_no_conventional_commit(commit_msg, config, mocker, tmpdir):
| cz check does not detect incorrectly formatted commit message
## Description
Looks like cz does not detect properly incorrect commit messages, it only parses first line?
## Steps to reproduce
1. create file named BAD_MSG with the following content:
```text
ci: check commit message on merge
testing with more complex commit mes
age with error
```
as you can see there is no empty line between first and second line.
2. run `cz check --commit-msg-file BAD_MSG`
## Current behavior
```
Commit validation: successful!
```
## Desired behavior
```
commit validation: failed!
please enter a commit message in the commitizen format.
commit "": "CI_COMMIT_MESSAGE"
pattern: (build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\(\S+\))?!?:(\s.*)
```
## Environment
cz version -r
```
Commitizen Version: 2.20.0
Python Version: 3.8.10 (default, Sep 28 2021, 16:10:42)
[GCC 9.3.0]
Operating System: Linux
```
| 0.0 | 2be6c41f33fe28e9e784c87fec23bb9f6246a3f9 | [
"tests/commands/test_check_command.py::test_check_no_conventional_commit[ci:"
]
| [
"tests/commands/test_check_command.py::test_check_jira_fails",
"tests/commands/test_check_command.py::test_check_jira_command_after_issue_one_space",
"tests/commands/test_check_command.py::test_check_jira_command_after_issue_two_spaces",
"tests/commands/test_check_command.py::test_check_jira_text_between_issue_and_command",
"tests/commands/test_check_command.py::test_check_jira_multiple_commands",
"tests/commands/test_check_command.py::test_check_conventional_commit_succeeds",
"tests/commands/test_check_command.py::test_check_no_conventional_commit[feat!(lang):",
"tests/commands/test_check_command.py::test_check_no_conventional_commit[no",
"tests/commands/test_check_command.py::test_check_conventional_commit[feat(lang)!:",
"tests/commands/test_check_command.py::test_check_conventional_commit[feat(lang):",
"tests/commands/test_check_command.py::test_check_conventional_commit[feat:",
"tests/commands/test_check_command.py::test_check_conventional_commit[bump:",
"tests/commands/test_check_command.py::test_check_command_when_commit_file_not_found",
"tests/commands/test_check_command.py::test_check_a_range_of_git_commits",
"tests/commands/test_check_command.py::test_check_a_range_of_git_commits_and_failed",
"tests/commands/test_check_command.py::test_check_command_with_invalid_argument",
"tests/commands/test_check_command.py::test_check_command_with_empty_range",
"tests/commands/test_check_command.py::test_check_a_range_of_failed_git_commits",
"tests/commands/test_check_command.py::test_check_command_with_valid_message",
"tests/commands/test_check_command.py::test_check_command_with_invalid_message",
"tests/commands/test_check_command.py::test_check_command_with_empty_message",
"tests/commands/test_check_command.py::test_check_command_with_allow_abort_arg",
"tests/commands/test_check_command.py::test_check_command_with_allow_abort_config",
"tests/commands/test_check_command.py::test_check_command_override_allow_abort_config",
"tests/commands/test_check_command.py::test_check_command_with_pipe_message",
"tests/commands/test_check_command.py::test_check_command_with_pipe_message_and_failed",
"tests/commands/test_check_command.py::test_check_command_with_comment_in_messege_file"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2022-04-11 16:33:53+00:00 | mit | 1,652 |
|
commitizen-tools__commitizen-512 | diff --git a/commitizen/cli.py b/commitizen/cli.py
index bf751b44..d9f1025b 100644
--- a/commitizen/cli.py
+++ b/commitizen/cli.py
@@ -240,6 +240,12 @@ data = {
"help": "commit message that needs to be checked",
"exclusive_group": "group1",
},
+ {
+ "name": ["--allow-abort"],
+ "action": "store_true",
+ "default": False,
+ "help": "allow empty commit messages, which typically abort a commit",
+ },
],
},
{
diff --git a/commitizen/commands/check.py b/commitizen/commands/check.py
index a32613e7..fb79e805 100644
--- a/commitizen/commands/check.py
+++ b/commitizen/commands/check.py
@@ -26,6 +26,9 @@ class Check:
self.commit_msg_file: Optional[str] = arguments.get("commit_msg_file")
self.commit_msg: Optional[str] = arguments.get("message")
self.rev_range: Optional[str] = arguments.get("rev_range")
+ self.allow_abort: bool = bool(
+ arguments.get("allow_abort", config.settings["allow_abort"])
+ )
self._valid_command_argument()
@@ -33,15 +36,16 @@ class Check:
self.cz = factory.commiter_factory(self.config)
def _valid_command_argument(self):
- number_args_provided = (
- bool(self.commit_msg_file) + bool(self.commit_msg) + bool(self.rev_range)
+ num_exclusive_args_provided = sum(
+ arg is not None
+ for arg in (self.commit_msg_file, self.commit_msg, self.rev_range)
)
- if number_args_provided == 0 and not os.isatty(0):
+ if num_exclusive_args_provided == 0 and not os.isatty(0):
self.commit_msg: Optional[str] = sys.stdin.read()
- elif number_args_provided != 1:
+ elif num_exclusive_args_provided != 1:
raise InvalidCommandArgumentError(
(
- "One and only one argument is required for check command! "
+ "Only one of --rev-range, --message, and --commit-msg-file is permitted by check command! "
"See 'cz check -h' for more information"
)
)
@@ -60,7 +64,7 @@ class Check:
ill_formated_commits = [
commit
for commit in commits
- if not Check.validate_commit_message(commit.message, pattern)
+ if not self.validate_commit_message(commit.message, pattern)
]
displayed_msgs_content = "\n".join(
[
@@ -79,7 +83,8 @@ class Check:
def _get_commits(self):
# Get commit message from file (--commit-msg-file)
- if self.commit_msg_file:
+ if self.commit_msg_file is not None:
+ # Enter this branch if commit_msg_file is "".
with open(self.commit_msg_file, "r", encoding="utf-8") as commit_file:
msg = commit_file.read()
msg = self._filter_comments(msg)
@@ -87,7 +92,8 @@ class Check:
commit_title = msg.split("\n")[0]
commit_body = "\n".join(msg.split("\n")[1:])
return [git.GitCommit(rev="", title=commit_title, body=commit_body)]
- elif self.commit_msg:
+ elif self.commit_msg is not None:
+ # Enter this branch if commit_msg is "".
self.commit_msg = self._filter_comments(self.commit_msg)
return [git.GitCommit(rev="", title="", body=self.commit_msg)]
@@ -98,8 +104,9 @@ class Check:
lines = [line for line in msg.split("\n") if not line.startswith("#")]
return "\n".join(lines)
- @staticmethod
- def validate_commit_message(commit_msg: str, pattern: str) -> bool:
+ def validate_commit_message(self, commit_msg: str, pattern: str) -> bool:
+ if not commit_msg:
+ return self.allow_abort
if (
commit_msg.startswith("Merge")
or commit_msg.startswith("Revert")
diff --git a/commitizen/cz/__init__.py b/commitizen/cz/__init__.py
index f141e1c2..e14cb9f7 100644
--- a/commitizen/cz/__init__.py
+++ b/commitizen/cz/__init__.py
@@ -20,7 +20,7 @@ def discover_plugins(path: Iterable[str] = None) -> Dict[str, Type[BaseCommitize
Dict[str, Type[BaseCommitizen]]: Registry with found plugins
"""
plugins = {}
- for finder, name, ispkg in pkgutil.iter_modules(path):
+ for _finder, name, _ispkg in pkgutil.iter_modules(path):
try:
if name.startswith("cz_"):
plugins[name] = importlib.import_module(name).discover_this
diff --git a/commitizen/defaults.py b/commitizen/defaults.py
index 0b217bf7..35a518ad 100644
--- a/commitizen/defaults.py
+++ b/commitizen/defaults.py
@@ -31,6 +31,7 @@ class Settings(TypedDict, total=False):
version_files: List[str]
tag_format: Optional[str]
bump_message: Optional[str]
+ allow_abort: bool
changelog_file: str
changelog_incremental: bool
changelog_start_rev: Optional[str]
@@ -56,6 +57,7 @@ DEFAULT_SETTINGS: Settings = {
"version_files": [],
"tag_format": None, # example v$version
"bump_message": None, # bumped v$current_version to $new_version
+ "allow_abort": False,
"changelog_file": "CHANGELOG.md",
"changelog_incremental": False,
"changelog_start_rev": None,
diff --git a/docs/check.md b/docs/check.md
index e1f0344e..759d60d9 100644
--- a/docs/check.md
+++ b/docs/check.md
@@ -7,7 +7,11 @@ If you want to setup an automatic check before every git commit, please refer to
[Automatically check message before commit](auto_check.md).
## Usage
-There are three arguments that you can use one of them to check commit message.
+There are three mutually exclusive ways to use `cz check`:
+
+- with `--rev-range` to check a range of pre-existing commits
+- with `--message` or by piping the message to it to check a given string
+- or with `--commit-msg-file` to read the commit message from a file
### Git Rev Range
If you'd like to check a commit's message after it has already been created, then you can specify the range of commits to check with `--rev-range REV_RANGE`.
@@ -46,3 +50,12 @@ $ cz check --commit-msg-file COMMIT_MSG_FILE
In this option, COMMIT_MSG_FILE is the path of the temporal file that contains the commit message.
This argument can be useful when cooperating with git hook, please check [Automatically check message before commit](auto_check.md) for more information about how to use this argument with git hook.
+
+### Allow Abort
+
+```bash
+cz check --message MESSAGE --allow-abort
+```
+
+Empty commit messages typically instruct Git to abort a commit, so you can pass `--allow-abort` to
+permit them. Since `git commit` accepts an `--allow-empty-message` flag (primarily for wrapper scripts), you may wish to disallow such commits in CI. `--allow-abort` may be used in conjunction with any of the other options.
diff --git a/docs/config.md b/docs/config.md
index 119db6f7..6a7838e2 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -131,6 +131,7 @@ commitizen:
| `update_changelog_on_bump` | `bool` | `false` | Create changelog when running `cz bump` |
| `annotated_tag` | `bool` | `false` | Use annotated tags instead of lightweight tags. [See difference][annotated-tags-vs-lightweight] |
| `bump_message` | `str` | `None` | Create custom commit message, useful to skip ci. [See more][bump_message] |
+| `allow_abort` | `bool` | `false` | Disallow empty commit messages, useful in ci. [See more][allow_abort] |
| `changelog_file` | `str` | `CHANGELOG.md` | filename of exported changelog |
| `changelog_incremental` | `bool` | `false` | Update changelog with the missing versions. This is good if you don't want to replace previous versions in the file. Note: when doing `cz bump --changelog` this is automatically set to `true` |
| `changelog_start_rev` | `str` | `None` | Start from a given git rev to generate the changelog |
@@ -141,6 +142,7 @@ commitizen:
[version_files]: bump.md#version_files
[tag_format]: bump.md#tag_format
[bump_message]: bump.md#bump_message
+[allow_abort]: check.md#allow-abort
[additional-features]: https://github.com/tmbo/questionary#additional-features
[customization]: customization.md
[shortcuts]: customization.md#shortcut-keys
| commitizen-tools/commitizen | 713ce195afbfd449eb67c2fcd792b68e0b6048b4 | diff --git a/tests/commands/test_check_command.py b/tests/commands/test_check_command.py
index 26db697b..e5f62d0a 100644
--- a/tests/commands/test_check_command.py
+++ b/tests/commands/test_check_command.py
@@ -200,14 +200,15 @@ def test_check_a_range_of_git_commits_and_failed(config, mocker):
error_mock.assert_called_once()
-def test_check_command_with_invalid_argment(config):
+def test_check_command_with_invalid_argument(config):
with pytest.raises(InvalidCommandArgumentError) as excinfo:
commands.Check(
config=config,
arguments={"commit_msg_file": "some_file", "rev_range": "HEAD~10..master"},
)
- assert "One and only one argument is required for check command!" in str(
- excinfo.value
+ assert (
+ "Only one of --rev-range, --message, and --commit-msg-file is permitted by check command!"
+ in str(excinfo.value)
)
@@ -257,6 +258,46 @@ def test_check_command_with_invalid_message(config, mocker):
error_mock.assert_called_once()
+def test_check_command_with_empty_message(config, mocker):
+ error_mock = mocker.patch("commitizen.out.error")
+ check_cmd = commands.Check(config=config, arguments={"message": ""})
+
+ with pytest.raises(InvalidCommitMessageError):
+ check_cmd()
+ error_mock.assert_called_once()
+
+
+def test_check_command_with_allow_abort_arg(config, mocker):
+ success_mock = mocker.patch("commitizen.out.success")
+ check_cmd = commands.Check(
+ config=config, arguments={"message": "", "allow_abort": True}
+ )
+
+ check_cmd()
+ success_mock.assert_called_once()
+
+
+def test_check_command_with_allow_abort_config(config, mocker):
+ success_mock = mocker.patch("commitizen.out.success")
+ config.settings["allow_abort"] = True
+ check_cmd = commands.Check(config=config, arguments={"message": ""})
+
+ check_cmd()
+ success_mock.assert_called_once()
+
+
+def test_check_command_override_allow_abort_config(config, mocker):
+ error_mock = mocker.patch("commitizen.out.error")
+ config.settings["allow_abort"] = True
+ check_cmd = commands.Check(
+ config=config, arguments={"message": "", "allow_abort": False}
+ )
+
+ with pytest.raises(InvalidCommitMessageError):
+ check_cmd()
+ error_mock.assert_called_once()
+
+
def test_check_command_with_pipe_message(mocker, capsys):
testargs = ["cz", "check"]
mocker.patch.object(sys, "argv", testargs)
diff --git a/tests/test_conf.py b/tests/test_conf.py
index 786af257..f051a1f5 100644
--- a/tests/test_conf.py
+++ b/tests/test_conf.py
@@ -40,6 +40,7 @@ _settings = {
"version": "1.0.0",
"tag_format": None,
"bump_message": None,
+ "allow_abort": False,
"version_files": ["commitizen/__version__.py", "pyproject.toml"],
"style": [["pointer", "reverse"], ["question", "underline"]],
"changelog_file": "CHANGELOG.md",
@@ -54,6 +55,7 @@ _new_settings = {
"version": "2.0.0",
"tag_format": None,
"bump_message": None,
+ "allow_abort": False,
"version_files": ["commitizen/__version__.py", "pyproject.toml"],
"style": [["pointer", "reverse"], ["question", "underline"]],
"changelog_file": "CHANGELOG.md",
| Aborted Commit Considered to Fail Validation When Run As commit-msg Hook
## Description
Git interprets an empty commit message to mean that a commit should be aborted, but calls all commit-msg hooks anyways. This causes pre-commit hooks that run as commit-msg hooks but don't guard against empty commit messages to spew errors en masse when the commit was already being intentionally aborted.
## Steps to reproduce
1. Configure commitizen to run as a commit-msg hook using pre-commit as described below.
2. `touch foo && git add && git commit`
3. Save an empty commit message.
For step 1, add the following to `.pre-commit-config.yaml`:
```
yaml
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.18.1
hooks:
- id: commitizen
stages:
- commit-msg
```
## Current behavior
[Pre-commit follows git's lead and calls commitizen when the commit message is empty when run as a commit-msg hook](https://github.com/pre-commit/pre-commit/issues/2052). This leads to the following error:
```
commitizen check..............................................................Failed
- hook id: commitizen
- exit code: 14
commit validation: failed!
please enter a commit message in the commitizen format.
commit "": "# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch foo
#
# Changes to be committed:
# ,,,
pattern: (build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\(\S+\))?!?:(\s.*)
```
The commit is still correctly aborted of course.
## Desired behavior
I expected the commitizen commit-msg hook to silently report success in this case since there is no commit message to check.
## Environment
- commitizen version: 2.18.1
- python version: Python 3.9.5
- operating system: Linux
| 0.0 | 713ce195afbfd449eb67c2fcd792b68e0b6048b4 | [
"tests/commands/test_check_command.py::test_check_command_with_invalid_argument",
"tests/commands/test_check_command.py::test_check_command_with_empty_message",
"tests/commands/test_check_command.py::test_check_command_with_allow_abort_arg",
"tests/commands/test_check_command.py::test_check_command_with_allow_abort_config",
"tests/commands/test_check_command.py::test_check_command_override_allow_abort_config",
"tests/test_conf.py::test_set_key[pyproject.toml]",
"tests/test_conf.py::test_set_key[.cz.toml]",
"tests/test_conf.py::test_set_key[.cz.json]",
"tests/test_conf.py::test_set_key[cz.json]",
"tests/test_conf.py::test_set_key[.cz.yaml]",
"tests/test_conf.py::test_set_key[cz.yaml]",
"tests/test_conf.py::TestReadCfg::test_load_conf[pyproject.toml]",
"tests/test_conf.py::TestReadCfg::test_load_conf[.cz.toml]",
"tests/test_conf.py::TestReadCfg::test_load_conf[.cz.json]",
"tests/test_conf.py::TestReadCfg::test_load_conf[cz.json]",
"tests/test_conf.py::TestReadCfg::test_load_conf[.cz.yaml]",
"tests/test_conf.py::TestReadCfg::test_load_conf[cz.yaml]",
"tests/test_conf.py::TestReadCfg::test_load_empty_pyproject_toml_and_cz_toml_with_config"
]
| [
"tests/commands/test_check_command.py::test_check_jira_fails",
"tests/commands/test_check_command.py::test_check_jira_command_after_issue_one_space",
"tests/commands/test_check_command.py::test_check_jira_command_after_issue_two_spaces",
"tests/commands/test_check_command.py::test_check_jira_text_between_issue_and_command",
"tests/commands/test_check_command.py::test_check_jira_multiple_commands",
"tests/commands/test_check_command.py::test_check_conventional_commit_succeeds",
"tests/commands/test_check_command.py::test_check_no_conventional_commit[feat!(lang):",
"tests/commands/test_check_command.py::test_check_no_conventional_commit[no",
"tests/commands/test_check_command.py::test_check_conventional_commit[feat(lang)!:",
"tests/commands/test_check_command.py::test_check_conventional_commit[feat(lang):",
"tests/commands/test_check_command.py::test_check_conventional_commit[feat:",
"tests/commands/test_check_command.py::test_check_conventional_commit[bump:",
"tests/commands/test_check_command.py::test_check_command_when_commit_file_not_found",
"tests/commands/test_check_command.py::test_check_a_range_of_git_commits",
"tests/commands/test_check_command.py::test_check_a_range_of_git_commits_and_failed",
"tests/commands/test_check_command.py::test_check_command_with_empty_range",
"tests/commands/test_check_command.py::test_check_a_range_of_failed_git_commits",
"tests/commands/test_check_command.py::test_check_command_with_valid_message",
"tests/commands/test_check_command.py::test_check_command_with_invalid_message",
"tests/commands/test_check_command.py::test_check_command_with_pipe_message",
"tests/commands/test_check_command.py::test_check_command_with_pipe_message_and_failed",
"tests/commands/test_check_command.py::test_check_command_with_comment_in_messege_file",
"tests/test_conf.py::test_find_git_project_root",
"tests/test_conf.py::TestReadCfg::test_conf_returns_default_when_no_files",
"tests/test_conf.py::TestTomlConfig::test_init_empty_config_content_with_existing_content",
"tests/test_conf.py::TestJsonConfig::test_init_empty_config_content"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-05-05 07:03:12+00:00 | mit | 1,653 |
|
commitizen-tools__commitizen-552 | diff --git a/commitizen/cmd.py b/commitizen/cmd.py
index 7f4efb6a..656dea07 100644
--- a/commitizen/cmd.py
+++ b/commitizen/cmd.py
@@ -3,6 +3,8 @@ from typing import NamedTuple
from charset_normalizer import from_bytes
+from commitizen.exceptions import CharacterSetDecodeError
+
class Command(NamedTuple):
out: str
@@ -12,6 +14,19 @@ class Command(NamedTuple):
return_code: int
+def _try_decode(bytes_: bytes) -> str:
+ try:
+ return bytes_.decode("utf-8")
+ except UnicodeDecodeError:
+ charset_match = from_bytes(bytes_).best()
+ if charset_match is None:
+ raise CharacterSetDecodeError()
+ try:
+ return bytes_.decode(charset_match.encoding)
+ except UnicodeDecodeError as e:
+ raise CharacterSetDecodeError() from e
+
+
def run(cmd: str) -> Command:
process = subprocess.Popen(
cmd,
@@ -23,8 +38,8 @@ def run(cmd: str) -> Command:
stdout, stderr = process.communicate()
return_code = process.returncode
return Command(
- str(from_bytes(stdout).best()),
- str(from_bytes(stderr).best()),
+ _try_decode(stdout),
+ _try_decode(stderr),
stdout,
stderr,
return_code,
diff --git a/commitizen/exceptions.py b/commitizen/exceptions.py
index a95ab3b5..16869b5a 100644
--- a/commitizen/exceptions.py
+++ b/commitizen/exceptions.py
@@ -26,6 +26,7 @@ class ExitCode(enum.IntEnum):
INVALID_CONFIGURATION = 19
NOT_ALLOWED = 20
NO_INCREMENT = 21
+ UNRECOGNIZED_CHARACTERSET_ENCODING = 22
class CommitizenException(Exception):
@@ -148,3 +149,7 @@ class InvalidConfigurationError(CommitizenException):
class NotAllowed(CommitizenException):
exit_code = ExitCode.NOT_ALLOWED
+
+
+class CharacterSetDecodeError(CommitizenException):
+ exit_code = ExitCode.UNRECOGNIZED_CHARACTERSET_ENCODING
diff --git a/docs/exit_codes.md b/docs/exit_codes.md
index f4c2fa82..b3996460 100644
--- a/docs/exit_codes.md
+++ b/docs/exit_codes.md
@@ -28,4 +28,5 @@ These exit codes can be found in `commitizen/exceptions.py::ExitCode`.
| InvalidCommandArgumentError | 18 | The argument provide to command is invalid (e.g. `cz check -commit-msg-file filename --rev-range master..`) |
| InvalidConfigurationError | 19 | An error was found in the Commitizen Configuration, such as duplicates in `change_type_order` |
| NotAllowed | 20 | `--incremental` cannot be combined with a `rev_range` |
-| NoneIncrementExit | 21 | The commits found are not elegible to be bumped |
+| NoneIncrementExit | 21 | The commits found are not eligible to be bumped |
+| CharacterSetDecodeError | 22 | The character encoding of the command output could not be determined |
| commitizen-tools/commitizen | 3123fec3d8cdf0fb6bdbe759e466f63ac73f95b3 | diff --git a/tests/test_cmd.py b/tests/test_cmd.py
new file mode 100644
index 00000000..e8a869e0
--- /dev/null
+++ b/tests/test_cmd.py
@@ -0,0 +1,53 @@
+import pytest
+
+from commitizen import cmd
+from commitizen.exceptions import CharacterSetDecodeError
+
+
+# https://docs.python.org/3/howto/unicode.html
+def test_valid_utf8_encoded_strings():
+ valid_strings = (
+ "",
+ "ascii",
+ "🤦🏻♂️",
+ "﷽",
+ "\u0000",
+ )
+ assert all(s == cmd._try_decode(s.encode("utf-8")) for s in valid_strings)
+
+
+# A word of caution: just because an encoding can be guessed for a given
+# sequence of bytes and because that guessed encoding may yield a decoded
+# string, does not mean that that string was the original! For more, see:
+# https://docs.python.org/3/library/codecs.html#standard-encodings
+
+
+# Pick a random, non-utf8 encoding to test.
+def test_valid_cp1250_encoded_strings():
+ valid_strings = (
+ "",
+ "ascii",
+ "äöüß",
+ "ça va",
+ "jak se máte",
+ )
+ for s in valid_strings:
+ assert cmd._try_decode(s.encode("cp1250")) or True
+
+
+def test_invalid_bytes():
+ invalid_bytes = (b"\x73\xe2\x9d\xff\x00",)
+ for s in invalid_bytes:
+ with pytest.raises(CharacterSetDecodeError):
+ cmd._try_decode(s)
+
+
+def test_always_fail_decode():
+ class _bytes(bytes):
+ def decode(self, encoding="utf-8", errors="strict"):
+ raise UnicodeDecodeError(
+ encoding, self, 0, 0, "Failing intentionally for testing"
+ )
+
+ with pytest.raises(CharacterSetDecodeError):
+ cmd._try_decode(_bytes())
| `UnicodeDecodeError` if commit messages contain Unicode characters
### Description
If I run
```
cz changelog
```
and the commit messages contain Unicode characters like 🤦🏻♂️ (which is an eight-byte utf-8 sequence: `\xf0\x9f\xa4\xa6 \xf0\x9f\x8f\xbb`) then I get the following traceback
```
Traceback (most recent call last):
File "/.../.venv/bin/cz", line 8, in <module>
sys.exit(main())
File "/.../.venv/lib/python3.10/site-packages/commitizen/cli.py", line 389, in main
args.func(conf, vars(args))()
File "/.../.venv/lib/python3.10/site-packages/commitizen/commands/changelog.py", line 143, in __call__
commits = git.get_commits(
File "/.../.venv/lib/python3.10/site-packages/commitizen/git.py", line 98, in get_commits
c = cmd.run(command)
File "/.../.venv/lib/python3.10/site-packages/commitizen/cmd.py", line 32, in run
stdout.decode(chardet.detect(stdout)["encoding"] or "utf-8"),
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/encodings/cp1254.py", line 15, in decode
return codecs.charmap_decode(input,errors,decoding_table)
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 1689: character maps to <undefined>
```
The result of `chardet.detect()` here
https://github.com/commitizen-tools/commitizen/blob/2ff9f155435b487057ce5bd8e32e1ab02fd57c94/commitizen/cmd.py#L26
is:
```
{'encoding': 'Windows-1254', 'confidence': 0.6864215607255395, 'language': 'Turkish'}
```
An interesting character encoding prediction with a low confidence, which in turn picks the incorrect codec and then decoding the `bytes` fails. Using `decode("utf-8")` works fine. It looks like issue https://github.com/chardet/chardet/issues/148 is related to this.
I think the fix would be something like this to replace [these lines of code](https://github.com/commitizen-tools/commitizen/blob/2ff9f155435b487057ce5bd8e32e1ab02fd57c94/commitizen/cmd.py#L23-L31):
```python
stdout, stderr = process.communicate()
return_code = process.returncode
try:
stdout_s = stdout.decode("utf-8") # Try this one first.
except UnicodeDecodeError:
result = chardet.detect(stdout) # Final result of the UniversalDetector’s prediction.
# Consider checking confidence value of the result?
stdout_s = stdout.decode(result["encoding"])
try:
stderr_s = stderr.decode("utf-8") # Try this one first.
except UnicodeDecodeError:
result = chardet.detect(stderr) # Final result of the UniversalDetector’s prediction.
# Consider checking confidence value of the result?
stderr_s = stderr.decode(result["encoding"])
return Command(stdout_s, stderr_s, stdout, stderr, return_code)
```
### Steps to reproduce
Well I suppose you can add a few commits to a local branch an go crazy with much text and funky unicode characters (emojis with skin tones, flags, etc.), and then attempt to create a changelog.
### Current behavior
`cz` throws an exception.
### Desired behavior
`cz` creates a changelog.
### Screenshots
_No response_
### Environment
```
> cz version
2.29.3
> python --version
Python 3.10.5
> uname -a
Darwin pooh 18.7.0 Darwin Kernel Version 18.7.0: Mon Feb 10 21:08:45 PST 2020; root:xnu-4903.278.28~1/RELEASE_X86_64 x86_64 i386 Darwin
``` | 0.0 | 3123fec3d8cdf0fb6bdbe759e466f63ac73f95b3 | [
"tests/test_cmd.py::test_valid_utf8_encoded_strings",
"tests/test_cmd.py::test_valid_cp1250_encoded_strings",
"tests/test_cmd.py::test_invalid_bytes",
"tests/test_cmd.py::test_always_fail_decode"
]
| []
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-08-09 11:00:18+00:00 | mit | 1,654 |
|
commitizen-tools__commitizen-591 | diff --git a/commitizen/cli.py b/commitizen/cli.py
index 264bddb2..2064ef3b 100644
--- a/commitizen/cli.py
+++ b/commitizen/cli.py
@@ -183,6 +183,13 @@ data = {
"default": False,
"help": "retry commit if it fails the 1st time",
},
+ {
+ "name": "manual_version",
+ "type": str,
+ "nargs": "?",
+ "help": "bump to the given version (e.g: 1.5.3)",
+ "metavar": "MANUAL_VERSION",
+ },
],
},
{
diff --git a/commitizen/commands/bump.py b/commitizen/commands/bump.py
index abc329ea..bc430320 100644
--- a/commitizen/commands/bump.py
+++ b/commitizen/commands/bump.py
@@ -2,7 +2,7 @@ from logging import getLogger
from typing import List, Optional
import questionary
-from packaging.version import Version
+from packaging.version import InvalidVersion, Version
from commitizen import bump, cmd, factory, git, out
from commitizen.commands.changelog import Changelog
@@ -12,10 +12,12 @@ from commitizen.exceptions import (
BumpTagFailedError,
DryRunExit,
ExpectedExit,
+ InvalidManualVersion,
NoCommitsFoundError,
NoneIncrementExit,
NoPatternMapError,
NotAGitProjectError,
+ NotAllowed,
NoVersionSpecifiedError,
)
@@ -102,10 +104,26 @@ class Bump:
dry_run: bool = self.arguments["dry_run"]
is_yes: bool = self.arguments["yes"]
increment: Optional[str] = self.arguments["increment"]
- prerelease: str = self.arguments["prerelease"]
+ prerelease: Optional[str] = self.arguments["prerelease"]
devrelease: Optional[int] = self.arguments["devrelease"]
is_files_only: Optional[bool] = self.arguments["files_only"]
is_local_version: Optional[bool] = self.arguments["local_version"]
+ manual_version = self.arguments["manual_version"]
+
+ if manual_version:
+ if increment:
+ raise NotAllowed("--increment cannot be combined with MANUAL_VERSION")
+
+ if prerelease:
+ raise NotAllowed("--prerelease cannot be combined with MANUAL_VERSION")
+
+ if devrelease is not None:
+ raise NotAllowed("--devrelease cannot be combined with MANUAL_VERSION")
+
+ if is_local_version:
+ raise NotAllowed(
+ "--local-version cannot be combined with MANUAL_VERSION"
+ )
current_tag_version: str = bump.normalize_tag(
current_version, tag_format=tag_format
@@ -127,34 +145,43 @@ class Bump:
if not commits and not current_version_instance.is_prerelease:
raise NoCommitsFoundError("[NO_COMMITS_FOUND]\n" "No new commits found.")
- if increment is None:
- increment = self.find_increment(commits)
-
- # It may happen that there are commits, but they are not elegible
- # for an increment, this generates a problem when using prerelease (#281)
- if (
- prerelease
- and increment is None
- and not current_version_instance.is_prerelease
- ):
- raise NoCommitsFoundError(
- "[NO_COMMITS_FOUND]\n"
- "No commits found to generate a pre-release.\n"
- "To avoid this error, manually specify the type of increment with `--increment`"
- )
-
- # Increment is removed when current and next version
- # are expected to be prereleases.
- if prerelease and current_version_instance.is_prerelease:
- increment = None
+ if manual_version:
+ try:
+ new_version = Version(manual_version)
+ except InvalidVersion as exc:
+ raise InvalidManualVersion(
+ "[INVALID_MANUAL_VERSION]\n"
+ f"Invalid manual version: '{manual_version}'"
+ ) from exc
+ else:
+ if increment is None:
+ increment = self.find_increment(commits)
+
+ # It may happen that there are commits, but they are not eligible
+ # for an increment, this generates a problem when using prerelease (#281)
+ if (
+ prerelease
+ and increment is None
+ and not current_version_instance.is_prerelease
+ ):
+ raise NoCommitsFoundError(
+ "[NO_COMMITS_FOUND]\n"
+ "No commits found to generate a pre-release.\n"
+ "To avoid this error, manually specify the type of increment with `--increment`"
+ )
- new_version = bump.generate_version(
- current_version,
- increment,
- prerelease=prerelease,
- devrelease=devrelease,
- is_local_version=is_local_version,
- )
+ # Increment is removed when current and next version
+ # are expected to be prereleases.
+ if prerelease and current_version_instance.is_prerelease:
+ increment = None
+
+ new_version = bump.generate_version(
+ current_version,
+ increment,
+ prerelease=prerelease,
+ devrelease=devrelease,
+ is_local_version=is_local_version,
+ )
new_tag_version = bump.normalize_tag(new_version, tag_format=tag_format)
message = bump.create_commit_message(
@@ -162,11 +189,9 @@ class Bump:
)
# Report found information
- information = (
- f"{message}\n"
- f"tag to create: {new_tag_version}\n"
- f"increment detected: {increment}\n"
- )
+ information = f"{message}\n" f"tag to create: {new_tag_version}\n"
+ if increment:
+ information += f"increment detected: {increment}\n"
if self.changelog_to_stdout:
# When the changelog goes to stdout, we want to send
@@ -179,7 +204,7 @@ class Bump:
if increment is None and new_tag_version == current_tag_version:
raise NoneIncrementExit(
"[NO_COMMITS_TO_BUMP]\n"
- "The commits found are not elegible to be bumped"
+ "The commits found are not eligible to be bumped"
)
if self.changelog:
diff --git a/commitizen/exceptions.py b/commitizen/exceptions.py
index 17a91778..cc923ab9 100644
--- a/commitizen/exceptions.py
+++ b/commitizen/exceptions.py
@@ -28,6 +28,7 @@ class ExitCode(enum.IntEnum):
NO_INCREMENT = 21
UNRECOGNIZED_CHARACTERSET_ENCODING = 22
GIT_COMMAND_ERROR = 23
+ INVALID_MANUAL_VERSION = 24
class CommitizenException(Exception):
@@ -158,3 +159,7 @@ class CharacterSetDecodeError(CommitizenException):
class GitCommandError(CommitizenException):
exit_code = ExitCode.GIT_COMMAND_ERROR
+
+
+class InvalidManualVersion(CommitizenException):
+ exit_code = ExitCode.INVALID_MANUAL_VERSION
diff --git a/docs/bump.md b/docs/bump.md
index dcd10158..bf6f00d8 100644
--- a/docs/bump.md
+++ b/docs/bump.md
@@ -56,10 +56,13 @@ Some examples:
$ cz bump --help
usage: cz bump [-h] [--dry-run] [--files-only] [--local-version] [--changelog]
[--no-verify] [--yes] [--tag-format TAG_FORMAT]
- [--bump-message BUMP_MESSAGE] [--increment {MAJOR,MINOR,PATCH}]
- [--prerelease {alpha,beta,rc}] [--devrelease {DEV}]
+ [--bump-message BUMP_MESSAGE] [--prerelease {alpha,beta,rc}]
+ [--devrelease DEVRELEASE] [--increment {MAJOR,MINOR,PATCH}]
[--check-consistency] [--annotated-tag] [--gpg-sign]
- [--changelog-to-stdout] [--retry]
+ [--changelog-to-stdout] [--retry] [MANUAL_VERSION]
+
+positional arguments:
+ MANUAL_VERSION bump to the given version (e.g: 1.5.3)
options:
-h, --help show this help message and exit
@@ -78,14 +81,15 @@ options:
when working with CI
--prerelease {alpha,beta,rc}, -pr {alpha,beta,rc}
choose type of prerelease
- --devrelease {DEV} specify dev release
+ --devrelease DEVRELEASE, -d DEVRELEASE
+ specify non-negative integer for dev. release
--increment {MAJOR,MINOR,PATCH}
manually specify the desired increment
--check-consistency, -cc
check consistency among versions defined in commitizen
configuration and version_files
- --gpg-sign, -s create a signed tag instead of lightweight one or annotated tag
--annotated-tag, -at create annotated tag instead of lightweight one
+ --gpg-sign, -s sign tag instead of lightweight one
--changelog-to-stdout
Output changelog to the stdout
--retry retry commit if it fails the 1st time
| commitizen-tools/commitizen | 4f4fb4da7e37e2db8d01d5faa3f717fc729411fc | diff --git a/tests/commands/test_bump_command.py b/tests/commands/test_bump_command.py
index 2eb1b1d2..7374e5aa 100644
--- a/tests/commands/test_bump_command.py
+++ b/tests/commands/test_bump_command.py
@@ -14,10 +14,12 @@ from commitizen.exceptions import (
DryRunExit,
ExitCode,
ExpectedExit,
+ InvalidManualVersion,
NoCommitsFoundError,
NoneIncrementExit,
NoPatternMapError,
NotAGitProjectError,
+ NotAllowed,
NoVersionSpecifiedError,
)
from tests.utils import create_file_and_commit
@@ -614,3 +616,67 @@ def test_bump_changelog_command_commits_untracked_changelog_and_version_files(
commit_file_names = git.get_filenames_in_commit()
assert "CHANGELOG.md" in commit_file_names
assert version_filepath in commit_file_names
+
+
[email protected](
+ "testargs",
+ [
+ ["cz", "bump", "--local-version", "1.2.3"],
+ ["cz", "bump", "--prerelease", "rc", "1.2.3"],
+ ["cz", "bump", "--devrelease", "0", "1.2.3"],
+ ["cz", "bump", "--devrelease", "1", "1.2.3"],
+ ["cz", "bump", "--increment", "PATCH", "1.2.3"],
+ ],
+)
+def test_bump_invalid_manual_args_raises_exception(mocker, testargs):
+ mocker.patch.object(sys, "argv", testargs)
+
+ with pytest.raises(NotAllowed):
+ cli.main()
+
+
[email protected]("tmp_commitizen_project")
[email protected](
+ "manual_version",
+ [
+ "noversion",
+ "1.2..3",
+ ],
+)
+def test_bump_invalid_manual_version_raises_exception(mocker, manual_version):
+ create_file_and_commit("feat: new file")
+
+ testargs = ["cz", "bump", "--yes", manual_version]
+ mocker.patch.object(sys, "argv", testargs)
+
+ with pytest.raises(InvalidManualVersion) as excinfo:
+ cli.main()
+
+ expected_error_message = (
+ "[INVALID_MANUAL_VERSION]\n" f"Invalid manual version: '{manual_version}'"
+ )
+ assert expected_error_message in str(excinfo.value)
+
+
[email protected]("tmp_commitizen_project")
[email protected](
+ "manual_version",
+ [
+ "0.0.1",
+ "0.1.0rc2",
+ "0.1.0.dev2",
+ "0.1.0+1.0.0",
+ "0.1.0rc2.dev2+1.0.0",
+ "0.1.1",
+ "0.2.0",
+ "1.0.0",
+ ],
+)
+def test_bump_manual_version(mocker, manual_version):
+ create_file_and_commit("feat: new file")
+
+ testargs = ["cz", "bump", "--yes", manual_version]
+ mocker.patch.object(sys, "argv", testargs)
+ cli.main()
+ tag_exists = git.tag_exist(manual_version)
+ assert tag_exists is True
| Manually bump entire version, not just manually specify which part to increment
The [docs](https://commitizen-tools.github.io/commitizen/bump/#about) state that the version can be manually bumped but I believe this is incorrect as there's no other mention of this in the docs or in the CLI help beyond `--increment {MAJOR,MINOR,PATCH}` which is merely specifying the part to auto-increment.
Why do I want to manually specify the version to bump to? Well, I don't but unfortunately, dev versions are not supported - but I still want to make use of commitizen's version-updating inside of files. Otherwise, I will need to use a separate tool in conjunction, such as [bumpversion](https://github.com/c4urself/bump2version).
I want to be able to do `cz bump 1.0.1` for example (optional positional arg or `--manual <foo>` option would be fine).
A question on this though - whilst commitizen does not support dev versions, will it still be able to successfully parse a PEP440-compatible version that includes a dev version, for the sake of bumping? I.e. will commitizen be able to bump `1.0.1.dev0+foo.bar.baz` to `1.0.2` or `1.1.0` etc.?
And the ultimate related question - is there any planned support for dev versions? | 0.0 | 4f4fb4da7e37e2db8d01d5faa3f717fc729411fc | [
"tests/commands/test_bump_command.py::test_bump_minor_increment_signed[feat:",
"tests/commands/test_bump_command.py::test_bump_minor_increment_signed[feat(user):",
"tests/commands/test_bump_command.py::test_bump_minor_increment_signed_config_file[feat:",
"tests/commands/test_bump_command.py::test_bump_minor_increment_signed_config_file[feat(user):",
"tests/commands/test_bump_command.py::test_bump_when_version_is_not_specify",
"tests/commands/test_bump_command.py::test_bump_in_non_git_project",
"tests/commands/test_bump_command.py::test_none_increment_exit_should_be_a_class",
"tests/commands/test_bump_command.py::test_none_increment_exit_should_be_expected_exit_subclass",
"tests/commands/test_bump_command.py::test_none_increment_exit_should_exist_in_bump",
"tests/commands/test_bump_command.py::test_none_increment_exit_is_exception",
"tests/commands/test_bump_command.py::test_bump_invalid_manual_args_raises_exception[testargs0]",
"tests/commands/test_bump_command.py::test_bump_invalid_manual_args_raises_exception[testargs1]",
"tests/commands/test_bump_command.py::test_bump_invalid_manual_args_raises_exception[testargs2]",
"tests/commands/test_bump_command.py::test_bump_invalid_manual_args_raises_exception[testargs3]",
"tests/commands/test_bump_command.py::test_bump_invalid_manual_args_raises_exception[testargs4]"
]
| []
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-09-18 11:13:43+00:00 | mit | 1,655 |
|
commitizen-tools__commitizen-669 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index aa1d625d..0aeaa4d0 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,7 +14,7 @@ repos:
- id: no-commit-to-branch
- repo: https://github.com/commitizen-tools/commitizen
- rev: v2.42.0 # automatically updated by Commitizen
+ rev: v2.42.1 # automatically updated by Commitizen
hooks:
- id: commitizen
- id: commitizen-branch
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cbc4c913..abfa1216 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,10 @@
+## v2.42.1 (2023-02-25)
+
+### Fix
+
+- **bump**: fixed environment variables in bump hooks
+
## v2.42.0 (2023-02-11)
### Feat
diff --git a/commitizen/__version__.py b/commitizen/__version__.py
index 6e61a2d0..03e94c21 100644
--- a/commitizen/__version__.py
+++ b/commitizen/__version__.py
@@ -1,1 +1,1 @@
-__version__ = "2.42.0"
+__version__ = "2.42.1"
diff --git a/commitizen/hooks.py b/commitizen/hooks.py
index f5efb807..f5505d0e 100644
--- a/commitizen/hooks.py
+++ b/commitizen/hooks.py
@@ -1,5 +1,7 @@
from __future__ import annotations
+import os
+
from commitizen import cmd, out
from commitizen.exceptions import RunHookError
@@ -25,7 +27,7 @@ def run(hooks, _env_prefix="CZ_", **env):
def _format_env(prefix: str, env: dict[str, str]) -> dict[str, str]:
"""_format_env() prefixes all given environment variables with the given
prefix so it can be passed directly to cmd.run()."""
- penv = dict()
+ penv = dict(os.environ)
for name, value in env.items():
name = prefix + name.upper()
value = str(value) if value is not None else ""
diff --git a/pyproject.toml b/pyproject.toml
index 03007ee6..d70c2a1e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,5 @@
[tool.commitizen]
-version = "2.42.0"
+version = "2.42.1"
tag_format = "v$version"
version_files = [
"pyproject.toml:version",
@@ -30,7 +30,7 @@ exclude = '''
[tool.poetry]
name = "commitizen"
-version = "2.42.0"
+version = "2.42.1"
description = "Python commitizen client tool"
authors = ["Santiago Fraire <[email protected]>"]
license = "MIT"
@@ -70,7 +70,7 @@ jinja2 = ">=2.10.3"
pyyaml = ">=3.08"
argcomplete = ">=1.12.1,<2.1"
typing-extensions = "^4.0.1"
-charset-normalizer = "^2.1.0"
+charset-normalizer = ">=2.1.0,<3.1"
[tool.poetry.dev-dependencies]
ipython = "^7.2"
| commitizen-tools/commitizen | 1ff575d177ad4a8fc47b08cd1e7f9fa3326f0478 | diff --git a/tests/test_bump_hooks.py b/tests/test_bump_hooks.py
index af1f2a2d..70ed7fe0 100644
--- a/tests/test_bump_hooks.py
+++ b/tests/test_bump_hooks.py
@@ -1,3 +1,4 @@
+import os
from unittest.mock import call
import pytest
@@ -17,7 +18,10 @@ def test_run(mocker: MockFixture):
hooks.run(bump_hooks)
cmd_run_mock.assert_has_calls(
- [call("pre_bump_hook", env={}), call("pre_bump_hook_1", env={})]
+ [
+ call("pre_bump_hook", env=dict(os.environ)),
+ call("pre_bump_hook_1", env=dict(os.environ)),
+ ]
)
| Support new charset-normalizer v3
### Description
The package `charset-normalizer` has released the v3. The dependency for this project is `<3.0.0,>=2.1.0`
### Possible Solution
Add the support for new version of `charset-normalizer` and add it to the supported versions
### Additional context
_No response_
### Additional context
https://github.com/Ousret/charset_normalizer/releases
The 3.0.0 released in Oct, version 3.0.1 released in Nov. | 0.0 | 1ff575d177ad4a8fc47b08cd1e7f9fa3326f0478 | [
"tests/test_bump_hooks.py::test_run"
]
| [
"tests/test_bump_hooks.py::test_run_error",
"tests/test_bump_hooks.py::test_format_env"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2023-02-12 21:22:16+00:00 | mit | 1,656 |
|
common-workflow-language__cwl-utils-223 | diff --git a/cwl_utils/utils.py b/cwl_utils/utils.py
index 435439e..1632b74 100644
--- a/cwl_utils/utils.py
+++ b/cwl_utils/utils.py
@@ -195,14 +195,9 @@ def resolved_path(
if link == "":
return base_url
else:
- return base_url._replace(
- path=str(
- (
- pathlib.Path(base_url.path).parent / pathlib.Path(link)
- ).resolve()
- )
+ return urllib.parse.urlparse(
+ urllib.parse.urljoin(base_url.geturl(), link_url.geturl())
)
-
else:
# Remote relative path
return urllib.parse.urlparse(
| common-workflow-language/cwl-utils | 064be751034c5476ece8bf9b2c7e2b94afeef067 | diff --git a/tests/test_utils.py b/tests/test_utils.py
new file mode 100644
index 0000000..f4d883d
--- /dev/null
+++ b/tests/test_utils.py
@@ -0,0 +1,14 @@
+from urllib.parse import urlparse
+
+from cwl_utils.utils import resolved_path
+
+
+def test_resoled_path() -> None:
+ base_url = urlparse(
+ "schemas/bclconvert-run-configuration/2.0.0--4.0.3/bclconvert-run-configuration__2.0.0--4.0.3.yaml"
+ )
+ link = "../../../schemas/samplesheet/2.0.0--4.0.3/samplesheet__2.0.0--4.0.3.yaml#samplesheet"
+ rpath = resolved_path(base_url, link)
+ assert rpath == urlparse(
+ "schemas/samplesheet/2.0.0--4.0.3/samplesheet__2.0.0--4.0.3.yaml#samplesheet"
+ )
| pack command fails on complex workflow with error 'MissingTypeName'
## Steps to reproduce
### Download complex workflow
```bash
wget "https://github.com/umccr/cwl-ica/releases/download/bclconvert-with-qc-pipeline%2F4.0.3__1682577366/bclconvert-with-qc-pipeline__4.0.3__1682577366.zip"
unzip bclconvert-with-qc-pipeline__4.0.3__1682577366.zip
cd bclconvert-with-qc-pipeline__4.0.3__1682577366/
```
### Validate cwltool --pack works fine
```bash
cwltool --version
```
```
/home/alexiswl/miniforge3/envs/cwl-ica/bin/cwltool 3.1.20230302145532
```
```bash
cwltool --pack "workflow.cwl" | jq 'keys'
```
```
[
"$graph",
"$namespaces",
"$schemas",
"cwlVersion"
]
```
### Try cwltuils pack
```python
import cwl_utils
import cwl_utils.__meta__
print(cwl_utils.__meta__.__version__)
0.26
from cwl_utils.pack import pack
pack('workflow.cwl')
```
Gives
```
Packing workflow.cwl
Parsing 1 types from /home/alexiswl/UMCCR/Projects/202305/create-bclconvert-test/bclconvert-with-qc-pipeline__4.0.3__1682577366/schemas/bclconvert-run-configuration/2.0.0--4.0.3/bclconvert-run-configuration__2.0.0--4.0.3.yaml
Parsing 1 types from /home/alexiswl/UMCCR/Projects/202305/create-bclconvert-test/bclconvert-with-qc-pipeline__4.0.3__1682577366/schemas/fastq-list-row/1.0.0/fastq-list-row__1.0.0.yaml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/pack.py", line 285, in pack
cwl = pack_process(cwl, full_url, cwl["cwlVersion"])
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/pack.py", line 73, in pack_process
cwl = resolve_schemadefs(cwl, base_url, user_defined_types)
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/pack.py", line 177, in resolve_schemadefs
cwl = schemadef.inline_types(cwl, "inputs", base_url, user_defined_types)
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 131, in inline_types
cwl[port] = [_inline_type(v, base_url, user_defined_types) for v in defs]
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 131, in <listcomp>
cwl[port] = [_inline_type(v, base_url, user_defined_types) for v in defs]
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 230, in _inline_type
v["type"] = _inline_type(_type, base_url, user_defined_types)
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 152, in _inline_type
"items": _inline_type(v[:-2], base_url, user_defined_types),
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 188, in _inline_type
return _inline_type(resolve_type, path_prefix, user_defined_types)
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 221, in _inline_type
v["fields"] = [
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 222, in <listcomp>
_inline_type(_f, base_url, user_defined_types) for _f in fields
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 230, in _inline_type
v["type"] = _inline_type(_type, base_url, user_defined_types)
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 191, in _inline_type
return [_inline_type(_v, base_url, user_defined_types) for _v in v]
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 191, in <listcomp>
return [_inline_type(_v, base_url, user_defined_types) for _v in v]
File "/home/alexiswl/miniforge3/envs/cwl-ica/lib/python3.10/site-packages/cwl_utils/schemadef.py", line 196, in _inline_type
raise errors.MissingTypeName(
cwl_utils.errors.MissingTypeName: In file /home/alexiswl/UMCCR/Projects/202305/create-bclconvert-test/bclconvert-with-qc-pipeline__4.0.3__1682577366/schemas/bclconvert-run-configuration/2.0.0--4.0.3/bclconvert-run-configuration__2.0.0--4.0.3.yaml, type None is missing type name
```
| 0.0 | 064be751034c5476ece8bf9b2c7e2b94afeef067 | [
"tests/test_utils.py::test_resoled_path"
]
| []
| {
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false
} | 2023-05-16 16:00:18+00:00 | apache-2.0 | 1,657 |
|
common-workflow-language__cwltool-1446 | diff --git a/cwltool/command_line_tool.py b/cwltool/command_line_tool.py
index 4554f501..08b10385 100644
--- a/cwltool/command_line_tool.py
+++ b/cwltool/command_line_tool.py
@@ -200,9 +200,7 @@ def revmap_file(
outside the container. Recognizes files in the pathmapper or remaps
internal output directories to the external directory.
"""
- split = urllib.parse.urlsplit(outdir)
- if not split.scheme:
- outdir = file_uri(str(outdir))
+ outdir_uri, outdir_path = file_uri(str(outdir)), outdir
# builder.outdir is the inner (container/compute node) output directory
# outdir is the outer (host/storage system) output directory
@@ -236,21 +234,20 @@ def revmap_file(
):
f["location"] = revmap_f[1]
elif (
- uripath == outdir
- or uripath.startswith(outdir + os.sep)
- or uripath.startswith(outdir + "/")
+ uripath == outdir_uri
+ or uripath.startswith(outdir_uri + os.sep)
+ or uripath.startswith(outdir_uri + "/")
):
- f["location"] = file_uri(path)
+ f["location"] = uripath
elif (
path == builder.outdir
or path.startswith(builder.outdir + os.sep)
or path.startswith(builder.outdir + "/")
):
- f["location"] = builder.fs_access.join(
- outdir, path[len(builder.outdir) + 1 :]
+ joined_path = builder.fs_access.join(
+ outdir_path, path[len(builder.outdir) + 1 :]
)
- elif not os.path.isabs(path):
- f["location"] = builder.fs_access.join(outdir, path)
+ f["location"] = file_uri(joined_path)
else:
raise WorkflowException(
"Output file path %s must be within designated output directory (%s) or an input "
@@ -1337,6 +1334,15 @@ class CommandLineTool(Process):
)
try:
prefix = fs_access.glob(outdir)
+ sorted_glob_result = sorted(
+ fs_access.glob(fs_access.join(outdir, gb)),
+ key=cmp_to_key(
+ cast(
+ Callable[[str, str], int],
+ locale.strcoll,
+ )
+ ),
+ )
r.extend(
[
{
@@ -1347,24 +1353,24 @@ class CommandLineTool(Process):
g[len(prefix[0]) + 1 :]
),
),
- "basename": os.path.basename(g),
- "nameroot": os.path.splitext(
- os.path.basename(g)
- )[0],
- "nameext": os.path.splitext(
- os.path.basename(g)
- )[1],
+ "basename": decoded_basename,
+ "nameroot": os.path.splitext(decoded_basename)[
+ 0
+ ],
+ "nameext": os.path.splitext(decoded_basename)[
+ 1
+ ],
"class": "File"
if fs_access.isfile(g)
else "Directory",
}
- for g in sorted(
- fs_access.glob(fs_access.join(outdir, gb)),
- key=cmp_to_key(
- cast(
- Callable[[str, str], int],
- locale.strcoll,
- )
+ for g, decoded_basename in zip(
+ sorted_glob_result,
+ map(
+ lambda x: os.path.basename(
+ urllib.parse.unquote(x)
+ ),
+ sorted_glob_result,
),
)
]
| common-workflow-language/cwltool | 63c7c724f37d6ef0502ac8f7721c8ed3c556188f | diff --git a/tests/test_path_checks.py b/tests/test_path_checks.py
index e8a300fe..df9d7f6a 100644
--- a/tests/test_path_checks.py
+++ b/tests/test_path_checks.py
@@ -1,11 +1,19 @@
-from pathlib import Path
-
import pytest
+import urllib.parse
-from cwltool.main import main
+from pathlib import Path
+from typing import cast
+from ruamel.yaml.comments import CommentedMap
+from schema_salad.sourceline import cmap
+from cwltool.main import main
+from cwltool.command_line_tool import CommandLineTool
+from cwltool.context import LoadingContext, RuntimeContext
+from cwltool.update import INTERNAL_VERSION
+from cwltool.utils import CWLObjectType
from .util import needs_docker
+
script = """
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
@@ -95,3 +103,67 @@ def test_unicode_in_output_files(tmp_path: Path, filename: str) -> None:
filename,
]
assert main(params) == 0
+
+
+def test_clt_returns_specialchar_names(tmp_path: Path) -> None:
+ """Confirm that special characters in filenames do not cause problems."""
+ loading_context = LoadingContext(
+ {
+ "metadata": {
+ "cwlVersion": INTERNAL_VERSION,
+ "http://commonwl.org/cwltool#original_cwlVersion": INTERNAL_VERSION,
+ }
+ }
+ )
+ clt = CommandLineTool(
+ cast(
+ CommentedMap,
+ cmap(
+ {
+ "cwlVersion": INTERNAL_VERSION,
+ "class": "CommandLineTool",
+ "inputs": [],
+ "outputs": [],
+ "requirements": [],
+ }
+ ),
+ ),
+ loading_context,
+ )
+
+ # Reserved characters will be URL encoded during the creation of a file URI
+ # Internal references to files are in URI form, and are therefore URL encoded
+ # Final output files should not retain their URL encoded filenames
+ rfc_3986_gen_delims = [":", "/", "?", "#", "[", "]", "@"]
+ rfc_3986_sub_delims = ["!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="]
+ unix_reserved = ["/", "\0"]
+ reserved = [
+ special_char
+ for special_char in (rfc_3986_gen_delims + rfc_3986_sub_delims)
+ if special_char not in unix_reserved
+ ]
+
+ # Mock an "output" file with the above special characters in its name
+ special = "".join(reserved)
+ output_schema = cast(
+ CWLObjectType, {"type": "File", "outputBinding": {"glob": special}}
+ )
+ mock_output = tmp_path / special
+ mock_output.touch()
+
+ # Prepare minimal arguments for CommandLineTool.collect_output()
+ builder = clt._init_job({}, RuntimeContext())
+ builder.pathmapper = clt.make_path_mapper(
+ builder.files, builder.stagedir, RuntimeContext(), True
+ )
+ fs_access = builder.make_fs_access(str(tmp_path))
+
+ result = cast(
+ CWLObjectType,
+ clt.collect_output(output_schema, builder, str(tmp_path), fs_access),
+ )
+
+ assert result["class"] == "File"
+ assert result["basename"] == special
+ assert result["nameroot"] == special
+ assert str(result["location"]).endswith(urllib.parse.quote(special))
| CommandLineTool output filenames are URL encoded
## Expected Behavior
CommandLineTool outputs whose filenames contain special characters should retain those special characters when copied to the final output directory. For example, if a CommandLineTool writes an output file with the name "(parentheses).txt", then the filename should remain "(parentheses).txt" when copied/moved to the final output directory.
## Actual Behavior
Filenames of CommandLineTool outputs are URL encoded after being copied/moved to the final output directory. For example, an output filename of "(parentheses).txt" becomes "%28parentheses%29.txt" in `command_line_tool.collect_output()`.
## Cursory Analysis
This happens because `fs_access.glob()` returns a file URI, which is itself URL encoded, and `command_line_tool.collect_output()` properly calls `urllib.parse.unquote()` to obtain the URL decoded **path** but fails to do so for the **basename** and **nameroot** fields. This record's **basename** is then used as the destination name for outputs copied/moved to final output directory.
## Workflow Code
### url_encode_test.cwl
```
class: CommandLineTool
cwlVersion: v1.0
requirements:
- class: InlineJavascriptRequirement
baseCommand: touch
inputs:
inp:
type: string
inputBinding:
position: 0
outputs:
out_file:
type: File
outputBinding:
glob: $(inputs.inp)
```
### job.json
`{"inp": "(parentheses).txt"}`
## Full Traceback
N/A
## Your Environment
* cwltool version: 3.1.20210426140515
| 0.0 | 63c7c724f37d6ef0502ac8f7721c8ed3c556188f | [
"tests/test_path_checks.py::test_clt_returns_specialchar_names"
]
| []
| {
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2021-05-18 23:40:54+00:00 | apache-2.0 | 1,658 |
|
common-workflow-language__cwltool-1469 | diff --git a/cwltool/context.py b/cwltool/context.py
index 83c098e1..daf6aa86 100644
--- a/cwltool/context.py
+++ b/cwltool/context.py
@@ -107,6 +107,7 @@ class RuntimeContext(ContextBase):
self.pull_image = True # type: bool
self.rm_container = True # type: bool
self.move_outputs = "move" # type: str
+ self.streaming_allowed: bool = False
self.singularity = False # type: bool
self.debug = False # type: bool
diff --git a/cwltool/job.py b/cwltool/job.py
index f515091e..0f9eb131 100644
--- a/cwltool/job.py
+++ b/cwltool/job.py
@@ -3,6 +3,7 @@ import functools
import itertools
import logging
import os
+import stat
import re
import shutil
import subprocess # nosec
@@ -175,13 +176,24 @@ class JobBase(HasReqsHints, metaclass=ABCMeta):
if not os.path.exists(self.outdir):
os.makedirs(self.outdir)
+ def is_streamable(file: str) -> bool:
+ if not runtimeContext.streaming_allowed:
+ return False
+ for inp in self.joborder.values():
+ if isinstance(inp, dict) and inp.get("location", None) == file:
+ return inp.get("streamable", False)
+ return False
+
for knownfile in self.pathmapper.files():
p = self.pathmapper.mapper(knownfile)
if p.type == "File" and not os.path.isfile(p[0]) and p.staged:
- raise WorkflowException(
- "Input file %s (at %s) not found or is not a regular "
- "file." % (knownfile, self.pathmapper.mapper(knownfile)[0])
- )
+ if not (
+ is_streamable(knownfile) and stat.S_ISFIFO(os.stat(p[0]).st_mode)
+ ):
+ raise WorkflowException(
+ "Input file %s (at %s) not found or is not a regular "
+ "file." % (knownfile, self.pathmapper.mapper(knownfile)[0])
+ )
if "listing" in self.generatefiles:
runtimeContext = runtimeContext.copy()
| common-workflow-language/cwltool | cef7385f242273060a584ebdac8334a8cb8c5c59 | diff --git a/tests/test_streaming.py b/tests/test_streaming.py
new file mode 100644
index 00000000..e3d3ec75
--- /dev/null
+++ b/tests/test_streaming.py
@@ -0,0 +1,108 @@
+"""Test that files marked as 'streamable' when 'streaming_allowed' can be named pipes."""
+import os
+
+import pytest
+from pathlib import Path
+from typing import cast
+
+from ruamel.yaml.comments import CommentedMap
+from schema_salad.sourceline import cmap
+
+from cwltool.command_line_tool import CommandLineTool
+from cwltool.context import LoadingContext, RuntimeContext
+from cwltool.errors import WorkflowException
+from cwltool.job import JobBase
+from cwltool.update import INTERNAL_VERSION
+from cwltool.utils import CWLObjectType
+from .util import get_data
+
+toolpath_object = cast(
+ CommentedMap,
+ cmap(
+ {
+ "cwlVersion": INTERNAL_VERSION,
+ "class": "CommandLineTool",
+ "inputs": [
+ {
+ "type": "File",
+ "id": "inp",
+ "streamable": True,
+ }
+ ],
+ "outputs": [],
+ "requirements": [],
+ }
+ ),
+)
+
+loading_context = LoadingContext(
+ {
+ "metadata": {
+ "cwlVersion": INTERNAL_VERSION,
+ "http://commonwl.org/cwltool#original_cwlVersion": INTERNAL_VERSION,
+ }
+ }
+)
+
+
+def test_regular_file() -> None:
+ """Test that regular files do not raise any exception when they are checked in job._setup."""
+ clt = CommandLineTool(
+ toolpath_object,
+ loading_context,
+ )
+ runtime_context = RuntimeContext()
+
+ joborder: CWLObjectType = {
+ "inp": {
+ "class": "File",
+ "location": get_data("tests/wf/whale.txt"),
+ }
+ }
+
+ job = next(clt.job(joborder, None, runtime_context))
+ assert isinstance(job, JobBase)
+
+ job._setup(runtime_context)
+
+
+streaming = [
+ (True, True, False),
+ (True, False, True),
+ (False, True, True),
+ (False, False, True),
+]
+
+
[email protected]("streamable,streaming_allowed,raise_exception", streaming)
+def test_input_can_be_named_pipe(
+ tmp_path: Path, streamable: bool, streaming_allowed: bool, raise_exception: bool
+) -> None:
+ """Test that input can be a named pipe."""
+ clt = CommandLineTool(
+ toolpath_object,
+ loading_context,
+ )
+
+ runtime_context = RuntimeContext()
+ runtime_context.streaming_allowed = streaming_allowed
+
+ path = tmp_path / "tmp"
+ os.mkfifo(path)
+
+ joborder: CWLObjectType = {
+ "inp": {
+ "class": "File",
+ "location": str(path),
+ "streamable": streamable,
+ }
+ }
+
+ job = next(clt.job(joborder, None, runtime_context))
+ assert isinstance(job, JobBase)
+
+ if raise_exception:
+ with pytest.raises(WorkflowException):
+ job._setup(runtime_context)
+ else:
+ job._setup(runtime_context)
| Request for cwltool to support named pipes
## Expected Behavior
Some runners such as Toil might implement file streaming with named pipes when `streamable` flag is true:
https://github.com/DataBiosphere/toil/issues/3469
## Actual Behavior
An exception is raised because a named pipe is not a regular file:
https://github.com/common-workflow-language/cwltool/blob/ed9dd4c3472e940a52dfe90049895f470bfd7329/cwltool/job.py#L180
## Workflow Code
```
#!/usr/bin cwl-runner
cwlVersion: v1.2
class: CommandLineTool
baseCommand: cat
stdout: $(inputs.output_filename)
arguments: ["-A"]
inputs:
input_file:
type: File
streamable: true
inputBinding:
position: 1
output_filename:
type: string?
default: out.txt
outputs:
count:
type: stdout
```
## Your Environment
* cwltool version:
3.0.20201203173111 (Linux)
| 0.0 | cef7385f242273060a584ebdac8334a8cb8c5c59 | [
"tests/test_streaming.py::test_input_can_be_named_pipe[True-True-False]"
]
| [
"tests/test_streaming.py::test_regular_file",
"tests/test_streaming.py::test_input_can_be_named_pipe[True-False-True]",
"tests/test_streaming.py::test_input_can_be_named_pipe[False-True-True]",
"tests/test_streaming.py::test_input_can_be_named_pipe[False-False-True]"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-07-01 14:52:04+00:00 | apache-2.0 | 1,659 |
|
common-workflow-language__cwltool-1760 | diff --git a/cwltool/main.py b/cwltool/main.py
index e024d22a..23c12d59 100755
--- a/cwltool/main.py
+++ b/cwltool/main.py
@@ -195,13 +195,15 @@ def generate_example_input(
else:
comment = "optional"
else:
- example = CommentedSeq()
- for index, entry in enumerate(inptype):
+ example, comment = generate_example_input(inptype[0], default)
+ type_names = []
+ for entry in inptype:
value, e_comment = generate_example_input(entry, default)
- example.append(value)
- example.yaml_add_eol_comment(e_comment, index)
+ if e_comment:
+ type_names.append(e_comment)
+ comment = "one of " + ", ".join(type_names)
if optional:
- comment = "optional"
+ comment = f"{comment} (optional)"
elif isinstance(inptype, Mapping) and "type" in inptype:
if inptype["type"] == "array":
first_item = cast(MutableSequence[CWLObjectType], inptype["items"])[0]
| common-workflow-language/cwltool | 14f402f643f86f72fa13a1d2e5fde3dcc7a90914 | diff --git a/tests/test_make_template.py b/tests/test_make_template.py
index 519f8603..f2bd2867 100644
--- a/tests/test_make_template.py
+++ b/tests/test_make_template.py
@@ -8,3 +8,21 @@ from cwltool import main
def test_anonymous_record() -> None:
inputs = cmap([{"type": "record", "fields": []}])
assert main.generate_example_input(inputs, None) == ({}, "Anonymous record type.")
+
+
+def test_union() -> None:
+ """Test for --make-template for a union type."""
+ inputs = cmap(["string", "string[]"])
+ assert main.generate_example_input(inputs, None) == (
+ "a_string",
+ 'one of type "string", type "string[]"',
+ )
+
+
+def test_optional_union() -> None:
+ """Test for --make-template for an optional union type."""
+ inputs = cmap(["null", "string", "string[]"])
+ assert main.generate_example_input(inputs, None) == (
+ "a_string",
+ 'one of type "string", type "string[]" (optional)',
+ )
| Creating input yaml - issue with ruamel comments.py
Hi,
I am using cwltool version 3.0.20201203173111 that came with `pip install cwl-runner`. This might be issue with ruamel or with my workflow but here is run command and trace:
`cwltool --make-template --debug tumor_only_exome.cwl > hiv_input.yml`
traceback:
```
Traceback (most recent call last):
File "/home/coyote/anaconda3/envs/cwl/lib/python3.6/site-packages/cwltool/main.py", line 991, in main
make_template(tool)
File "/home/coyote/anaconda3/envs/cwl/lib/python3.6/site-packages/cwltool/main.py", line 744, in make_template
generate_input_template(tool),
File "/home/coyote/anaconda3/envs/cwl/lib/python3.6/site-packages/cwltool/main.py", line 301, in generate_input_template
template.insert(0, name, value, comment)
File "/home/coyote/anaconda3/envs/cwl/lib/python3.6/site-packages/ruamel/yaml/comments.py", line 722, in insert
self.yaml_add_eol_comment(comment, key=key)
File "/home/coyote/anaconda3/envs/cwl/lib/python3.6/site-packages/ruamel/yaml/comments.py", line 295, in yaml_add_eol_comment
if comment[0] != '#':
IndexError: string index out of range
```
| 0.0 | 14f402f643f86f72fa13a1d2e5fde3dcc7a90914 | [
"tests/test_make_template.py::test_optional_union",
"tests/test_make_template.py::test_union"
]
| [
"tests/test_make_template.py::test_anonymous_record"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2022-11-08 16:34:47+00:00 | apache-2.0 | 1,660 |
|
common-workflow-language__schema_salad-476 | diff --git a/schema_salad/codegen.py b/schema_salad/codegen.py
index f735919..3c4144e 100644
--- a/schema_salad/codegen.py
+++ b/schema_salad/codegen.py
@@ -11,6 +11,7 @@ from typing import (
TextIO,
Union,
)
+from urllib.parse import urlsplit
from . import schema
from .codegen_base import CodeGenBase
@@ -33,12 +34,23 @@ def codegen(
examples: Optional[str] = None,
package: Optional[str] = None,
copyright: Optional[str] = None,
+ parser_info: Optional[str] = None,
) -> None:
"""Generate classes with loaders for the given Schema Salad description."""
j = schema.extend_and_specialize(i, loader)
gen = None # type: Optional[CodeGenBase]
+ base = schema_metadata.get("$base", schema_metadata.get("id"))
+ sp = urlsplit(base)
+ pkg = (
+ package
+ if package
+ else ".".join(
+ list(reversed(sp.netloc.split("."))) + sp.path.strip("/").split("/")
+ )
+ )
+ info = parser_info or pkg
if lang == "python":
if target:
dest: Union[TextIOWrapper, TextIO] = open(
@@ -46,13 +58,14 @@ def codegen(
)
else:
dest = sys.stdout
- gen = PythonCodeGen(dest, copyright=copyright)
+
+ gen = PythonCodeGen(dest, copyright=copyright, parser_info=info)
elif lang == "java":
gen = JavaCodeGen(
- schema_metadata.get("$base", schema_metadata.get("id")),
+ base,
target=target,
examples=examples,
- package=package,
+ package=pkg,
copyright=copyright,
)
else:
diff --git a/schema_salad/java_codegen.py b/schema_salad/java_codegen.py
index ff3e8ec..36c7641 100644
--- a/schema_salad/java_codegen.py
+++ b/schema_salad/java_codegen.py
@@ -14,7 +14,6 @@ from typing import (
Set,
Union,
)
-from urllib.parse import urlsplit
import pkg_resources
@@ -129,20 +128,13 @@ class JavaCodeGen(CodeGenBase):
base: str,
target: Optional[str],
examples: Optional[str],
- package: Optional[str],
+ package: str,
copyright: Optional[str],
) -> None:
super().__init__()
self.base_uri = base
- sp = urlsplit(base)
self.examples = examples
- self.package = (
- package
- if package
- else ".".join(
- list(reversed(sp.netloc.split("."))) + sp.path.strip("/").split("/")
- )
- )
+ self.package = package
self.artifact = self.package.split(".")[-1]
self.copyright = copyright
self.target_dir = Path(target or ".").resolve()
diff --git a/schema_salad/main.py b/schema_salad/main.py
index 04b972e..4dca459 100644
--- a/schema_salad/main.py
+++ b/schema_salad/main.py
@@ -129,6 +129,14 @@ def arg_parser() -> argparse.ArgumentParser:
help="Optional copyright of the input schema.",
),
+ parser.add_argument(
+ "--codegen-parser-info",
+ metavar="parser_info",
+ type=str,
+ default=None,
+ help="Optional parser name which is accessible via resulted parser API (Python only)",
+ )
+
exgroup.add_argument(
"--print-oneline",
action="store_true",
@@ -323,6 +331,7 @@ def main(argsl: Optional[List[str]] = None) -> int:
examples=args.codegen_examples,
package=args.codegen_package,
copyright=args.codegen_copyright,
+ parser_info=args.codegen_parser_info,
)
return 0
diff --git a/schema_salad/metaschema.py b/schema_salad/metaschema.py
index 8be526d..0d39020 100644
--- a/schema_salad/metaschema.py
+++ b/schema_salad/metaschema.py
@@ -674,6 +674,10 @@ def save_relative_uri(
return save(uri, top=False, base_url=base_url)
+def parser_info() -> str:
+ return "org.w3id.cwl.salad"
+
+
class Documented(Savable):
pass
diff --git a/schema_salad/python_codegen.py b/schema_salad/python_codegen.py
index 984a93d..458806e 100644
--- a/schema_salad/python_codegen.py
+++ b/schema_salad/python_codegen.py
@@ -68,13 +68,19 @@ def fmt(text: str, indent: int) -> str:
class PythonCodeGen(CodeGenBase):
"""Generation of Python code for a given Schema Salad definition."""
- def __init__(self, out: IO[str], copyright: Optional[str]) -> None:
+ def __init__(
+ self,
+ out: IO[str],
+ copyright: Optional[str],
+ parser_info: str,
+ ) -> None:
super().__init__()
self.out = out
self.current_class_is_abstract = False
self.serializer = StringIO()
self.idfield = ""
self.copyright = copyright
+ self.parser_info = parser_info
@staticmethod
def safe_name(name: str) -> str:
@@ -112,6 +118,14 @@ class PythonCodeGen(CodeGenBase):
stream.close()
self.out.write("\n\n")
+ self.out.write(
+ f"""def parser_info() -> str:
+ return "{self.parser_info}"
+
+
+"""
+ )
+
for primative in prims.values():
self.declare_type(primative)
| common-workflow-language/schema_salad | 5dd637fe792f12c985b5d0056b2494ad3220c107 | diff --git a/schema_salad/tests/test_python_codegen.py b/schema_salad/tests/test_python_codegen.py
index 6f0dee4..dcb1179 100644
--- a/schema_salad/tests/test_python_codegen.py
+++ b/schema_salad/tests/test_python_codegen.py
@@ -1,7 +1,7 @@
import inspect
import os
from pathlib import Path
-from typing import Any, Dict, List, cast
+from typing import Any, Dict, List, Optional, cast
import schema_salad.metaschema as cg_metaschema
from schema_salad import codegen
@@ -35,7 +35,12 @@ def test_meta_schema_gen_up_to_date(tmp_path: Path) -> None:
assert f.read() == inspect.getsource(cg_metaschema)
-def python_codegen(file_uri: str, target: Path) -> None:
+def python_codegen(
+ file_uri: str,
+ target: Path,
+ parser_info: Optional[str] = None,
+ package: Optional[str] = None,
+) -> None:
document_loader, avsc_names, schema_metadata, metaschema_loader = load_schema(
file_uri
)
@@ -50,4 +55,30 @@ def python_codegen(file_uri: str, target: Path) -> None:
schema_metadata,
document_loader,
target=str(target),
+ parser_info=parser_info,
+ package=package,
)
+
+
+def test_default_parser_info(tmp_path: Path) -> None:
+ src_target = tmp_path / "src.py"
+ python_codegen(metaschema_file_uri, src_target)
+ assert os.path.exists(src_target)
+ with open(src_target) as f:
+ assert 'def parser_info() -> str:\n return "org.w3id.cwl.salad"' in f.read()
+
+
+def test_parser_info(tmp_path: Path) -> None:
+ src_target = tmp_path / "src.py"
+ python_codegen(metaschema_file_uri, src_target, parser_info="cwl")
+ assert os.path.exists(src_target)
+ with open(src_target) as f:
+ assert 'def parser_info() -> str:\n return "cwl"' in f.read()
+
+
+def test_use_of_package_for_parser_info(tmp_path: Path) -> None:
+ src_target = tmp_path / "src.py"
+ python_codegen(metaschema_file_uri, src_target, package="cwl")
+ assert os.path.exists(src_target)
+ with open(src_target) as f:
+ assert 'def parser_info() -> str:\n return "cwl"' in f.read()
| pycodegen: add constant with name of the schema itself
Maybe a constant `parser_info`? Or a dictionary that we can add other value to later?
_Originally posted by @tom-tan in https://github.com/common-workflow-language/cwl-utils/issues/119#issuecomment-962523490_ | 0.0 | 5dd637fe792f12c985b5d0056b2494ad3220c107 | [
"schema_salad/tests/test_python_codegen.py::test_use_of_package_for_parser_info",
"schema_salad/tests/test_python_codegen.py::test_parser_info",
"schema_salad/tests/test_python_codegen.py::test_meta_schema_gen",
"schema_salad/tests/test_python_codegen.py::test_meta_schema_gen_up_to_date",
"schema_salad/tests/test_python_codegen.py::test_default_parser_info",
"schema_salad/tests/test_python_codegen.py::test_cwl_gen"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2021-11-08 12:15:16+00:00 | apache-2.0 | 1,661 |
|
common-workflow-language__schema_salad-556 | diff --git a/schema_salad/avro/schema.py b/schema_salad/avro/schema.py
index e02e61f..8af6202 100644
--- a/schema_salad/avro/schema.py
+++ b/schema_salad/avro/schema.py
@@ -503,15 +503,6 @@ class RecordSchema(NamedSchema):
new_field = Field(
atype, name, has_default, default, order, names, doc, other_props
)
- # make sure field name has not been used yet
- if new_field.name in parsed_fields:
- old_field = parsed_fields[new_field.name]
- if not is_subtype(old_field["type"], field["type"]):
- raise SchemaParseException(
- f"Field name {new_field.name} already in use with "
- "incompatible type. "
- f"{field['type']} vs {old_field['type']}."
- )
parsed_fields[new_field.name] = field
else:
raise SchemaParseException(f"Not a valid field: {field}")
diff --git a/schema_salad/schema.py b/schema_salad/schema.py
index 8652445..2e8a253 100644
--- a/schema_salad/schema.py
+++ b/schema_salad/schema.py
@@ -34,7 +34,7 @@ from schema_salad.utils import (
)
from . import _logger, jsonld_context, ref_resolver, validate
-from .avro.schema import Names, SchemaParseException, make_avsc_object
+from .avro.schema import Names, SchemaParseException, make_avsc_object, is_subtype
from .exceptions import (
ClassValidationException,
SchemaSaladException,
@@ -617,7 +617,7 @@ def extend_and_specialize(
for spec in aslist(stype["specialize"]):
specs[spec["specializeFrom"]] = spec["specializeTo"]
- exfields = [] # type: List[str]
+ exfields = [] # type: List[Any]
exsym = [] # type: List[str]
for ex in aslist(stype["extends"]):
if ex not in types:
@@ -645,8 +645,46 @@ def extend_and_specialize(
if stype["type"] == "record":
stype = copy.copy(stype)
- exfields.extend(stype.get("fields", []))
- stype["fields"] = exfields
+ combined_fields = []
+ fields = stype.get("fields", [])
+ # We use short names here so that if a type inherits a field
+ # (e.g. Child#id) from a parent (Parent#id) we avoid adding
+ # the same field twice (previously we had just
+ # ``exfields.extends(stype.fields)``).
+ sns_fields = {shortname(field["name"]): field for field in fields}
+ sns_exfields = {
+ shortname(exfield["name"]): exfield for exfield in exfields
+ }
+
+ # N.B.: This could be simpler. We could have a single loop
+ # to create the list of fields. The reason for this more
+ # convoluted solution is to make sure we keep the order
+ # of ``exfields`` first, and then the type fields. That's
+ # because we have unit tests that rely on the order that
+ # fields are written. Codegen output changes as well.
+ # We are relying on the insertion order preserving
+ # property of python dicts (i.e. relyig on Py3.5+).
+
+ # First pass adding the exfields.
+ for sn_exfield, exfield in sns_exfields.items():
+ field = sns_fields.get(sn_exfield, None)
+ if field is None:
+ field = exfield
+ else:
+ # make sure field name has not been used yet
+ if not is_subtype(exfield["type"], field["type"]):
+ raise SchemaParseException(
+ f"Field name {field['name']} already in use with "
+ "incompatible type. "
+ f"{field['type']} vs {exfield['type']}."
+ )
+ combined_fields.append(field)
+ # Second pass, now add the ones that are specific to the subtype.
+ for field in sns_fields.values():
+ if field not in combined_fields:
+ combined_fields.append(field)
+
+ stype["fields"] = combined_fields
fieldnames = set() # type: Set[str]
for field in stype["fields"]:
| common-workflow-language/schema_salad | 9f5180b913ad4e06747437b53382bc7d3683f642 | diff --git a/schema_salad/tests/inherited-attributes.yml b/schema_salad/tests/inherited-attributes.yml
new file mode 100644
index 0000000..d37a827
--- /dev/null
+++ b/schema_salad/tests/inherited-attributes.yml
@@ -0,0 +1,25 @@
+- name: Parent
+ doc: |
+ Parent record
+ documentRoot: true
+ docChild:
+ - "#Child"
+ type: record
+ fields:
+ - name: id
+ jsonldPredicate:
+ _id: "#id"
+ type: int
+ doc: Parent ID
+
+- name: Child
+ doc: |
+ Child record
+ type: record
+ extends: Parent
+ fields:
+ - name: id
+ jsonldPredicate:
+ _id: "#id"
+ type: int
+ doc: Child ID
diff --git a/schema_salad/tests/test_makedoc.py b/schema_salad/tests/test_makedoc.py
new file mode 100644
index 0000000..41fa8d6
--- /dev/null
+++ b/schema_salad/tests/test_makedoc.py
@@ -0,0 +1,18 @@
+"""Test schema-salad makedoc"""
+
+from io import StringIO
+
+from schema_salad.makedoc import makedoc
+
+from .util import get_data
+
+
+def test_schema_salad_inherit_docs() -> None:
+ """Test schema-salad-doc when types inherit and override values from parent types."""
+ schema_path = get_data("tests/inherited-attributes.yml")
+ assert schema_path
+ stdout = StringIO()
+ makedoc(stdout, schema_path)
+
+ # The parent ID documentation (i.e. Parent ID) must appear exactly once.
+ assert 1 == stdout.getvalue().count("Parent ID")
diff --git a/schema_salad/tests/test_subtypes.py b/schema_salad/tests/test_subtypes.py
index 1e0c56d..6d9473a 100644
--- a/schema_salad/tests/test_subtypes.py
+++ b/schema_salad/tests/test_subtypes.py
@@ -101,9 +101,8 @@ def test_avro_loading_subtype_bad() -> None:
path = get_data("tests/test_schema/avro_subtype_bad.yml")
assert path
target_error = (
- r"Union\s+item\s+must\s+be\s+a\s+valid\s+Avro\s+schema:\s+"
- r"Field\s+name\s+override_me\s+already\s+in\s+use\s+with\s+incompatible\s+"
- r"type\.\s+org\.w3id\.cwl\.salad\.Any\s+vs\s+\['string',\s+'int'\]\."
+ r"Field name .*\/override_me already in use with incompatible type. "
+ r"Any vs \['string', 'int'\]\."
)
with pytest.raises(SchemaParseException, match=target_error):
document_loader, avsc_names, schema_metadata, metaschema_loader = load_schema(
| schema-salad-doc produces duplicated attribute entry when inheriting from parent
Ref: https://github.com/common-workflow-language/cwl-v1.2/pull/166#issuecomment-1164571015
The latest release of `schema-salad` allows for overriding the documentation of a parent type in a child type. i.e.
```yaml
- name: Parent
doc: |
Parent record
documentRoot: true
docChild:
- "#Child"
type: record
fields:
- name: id
jsonldPredicate:
_id: "#id"
type: int
doc: Parent ID
- name: Child
doc: |
Child record
type: record
extends: Parent
fields:
- name: id
jsonldPredicate:
_id: "#id"
type: int
doc: Child ID
```
Note the `id` field has a different `doc` value in the child type. However, running this schema through `schema-salad`, it prints the `id` field twice in the child.
```bash
(venv) kinow@ranma:~/Development/python/workspace/schema_salad$ schema-salad-tool --print-doc schema_salad/tests/inherited-attributes.yml > /tmp/test.html
/home/kinow/Development/python/workspace/schema_salad/venv/bin/schema-salad-tool Current version: 8.3.20220622140130
```

| 0.0 | 9f5180b913ad4e06747437b53382bc7d3683f642 | [
"schema_salad/tests/test_subtypes.py::test_avro_loading_subtype_bad",
"schema_salad/tests/test_makedoc.py::test_schema_salad_inherit_docs"
]
| [
"schema_salad/tests/test_subtypes.py::test_subtypes[old5-new5-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[Any-int-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old19-new19-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old18-new18-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old15-new15-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[Any-new10-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old2-new2-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old17-new17-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[Any-null-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[Any-None-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old0-int-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old4-new4-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old1-new1-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[Any-new12-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[Any-new7-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[Any-new8-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old14-new14-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old16-new16-False]",
"schema_salad/tests/test_subtypes.py::test_subtypes[Any-new13-True]",
"schema_salad/tests/test_subtypes.py::test_subtypes[old3-new3-False]",
"schema_salad/tests/test_subtypes.py::test_avro_loading_subtype"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2022-06-23 23:02:14+00:00 | apache-2.0 | 1,662 |
|
compomics__psm_utils-61 | diff --git a/psm_utils/io/idxml.py b/psm_utils/io/idxml.py
index 84ecb26..07d79ad 100644
--- a/psm_utils/io/idxml.py
+++ b/psm_utils/io/idxml.py
@@ -422,7 +422,8 @@ class IdXMLWriter(WriterBase):
for feature, value in psm.rescoring_features.items():
if feature not in RESCORING_FEATURE_LIST:
- peptide_hit.setMetaValue(feature, value)
+ # Convert numpy objects to floats since pyopenms does not support numpy objects to be added
+ peptide_hit.setMetaValue(feature, float(value))
def _create_new_ids(self, psm_dict: dict) -> None:
"""
@@ -532,6 +533,9 @@ class IdXMLWriter(WriterBase):
"""Add meta values inplace to :py:class:`~pyopenms.PeptideHit` from a dictionary."""
if d is not None:
for key, value in d.items():
+ # Convert numpy objects to floats since pyopenms does not support numpy objects to be added
+ if not isinstance(value, str):
+ value = float(value)
peptide_hit.setMetaValue(key, value)
diff --git a/psm_utils/io/xtandem.py b/psm_utils/io/xtandem.py
index ebecb76..62eb2e6 100644
--- a/psm_utils/io/xtandem.py
+++ b/psm_utils/io/xtandem.py
@@ -44,6 +44,7 @@ Notes
from __future__ import annotations
+import logging
import re
import xml.etree.ElementTree as ET
from pathlib import Path
@@ -57,6 +58,8 @@ from psm_utils.io._base_classes import ReaderBase
from psm_utils.peptidoform import Peptidoform
from psm_utils.psm import PSM
+logger = logging.getLogger(__name__)
+
class XTandemReader(ReaderBase):
def __init__(
@@ -187,9 +190,15 @@ class XTandemReader(ReaderBase):
tree = ET.parse(str(filepath))
root = tree.getroot()
full_label = root.attrib["label"]
- run_match = re.search(r"\/(?P<run>\d+_?\d+)\.(?P<filetype>mgf|mzML|mzml)", full_label)
+ run_match = re.search(r"\/(?P<run>[^\s\/\\]+)\.(?P<filetype>mgf|mzML|mzml)", full_label)
if run_match:
run = run_match.group("run")
+ else:
+ run = Path(self.filepath).stem
+ logger.warning(
+ f"Could not parse run from X!Tandem XML label entry. Setting PSM filename `{run}` "
+ "as run."
+ )
return run
diff --git a/psm_utils/peptidoform.py b/psm_utils/peptidoform.py
index fd9695d..6da9a37 100644
--- a/psm_utils/peptidoform.py
+++ b/psm_utils/peptidoform.py
@@ -519,9 +519,10 @@ class Peptidoform:
def _format_number_as_string(num):
"""Format number as string for ProForma mass modifications."""
- sign = "+" if np.sign(num) == 1 else "-"
- num = str(num).rstrip("0").rstrip(".")
- return sign + num
+ # Using this method over `:+g` string formatting to avoid rounding and scientific notation
+ plus = "+" if np.sign(num) == 1 else "" # Add plus sign if positive
+ num = str(num).rstrip("0").rstrip(".") # Remove trailing zeros and decimal point
+ return plus + num
class PeptidoformException(PSMUtilsException):
| compomics/psm_utils | 37163f14360e31e6cbc3ea930418a799124c4b4f | diff --git a/tests/test_peptidoform.py b/tests/test_peptidoform.py
index 1e048e7..e37a558 100644
--- a/tests/test_peptidoform.py
+++ b/tests/test_peptidoform.py
@@ -1,6 +1,6 @@
from pyteomics import proforma
-from psm_utils.peptidoform import Peptidoform
+from psm_utils.peptidoform import Peptidoform, _format_number_as_string
class TestPeptidoform:
@@ -27,7 +27,12 @@ class TestPeptidoform:
assert isinstance(mod, proforma.TagBase)
def test_rename_modifications(self):
- label_mapping = {"ac": "Acetyl", "cm": "Carbamidomethyl"}
+ label_mapping = {
+ "ac": "Acetyl",
+ "cm": "Carbamidomethyl",
+ "+57.021": "Carbamidomethyl",
+ "-18.010565": "Glu->pyro-Glu",
+ }
test_cases = [
("ACDEFGHIK", "ACDEFGHIK"),
@@ -36,9 +41,26 @@ class TestPeptidoform:
("[Acetyl]-AC[cm]DEFGHIK", "[Acetyl]-AC[Carbamidomethyl]DEFGHIK"),
("<[cm]@C>[Acetyl]-ACDEFGHIK", "<[Carbamidomethyl]@C>[Acetyl]-ACDEFGHIK"),
("<[Carbamidomethyl]@C>[ac]-ACDEFGHIK", "<[Carbamidomethyl]@C>[Acetyl]-ACDEFGHIK"),
+ ("[ac]-AC[cm]DEFGHIK", "[Acetyl]-AC[Carbamidomethyl]DEFGHIK"),
+ ("AC[+57.021]DEFGHIK", "AC[Carbamidomethyl]DEFGHIK"),
+ ("E[-18.010565]DEK", "E[Glu->pyro-Glu]DEK"),
]
for test_case_in, expected_out in test_cases:
peptidoform = Peptidoform(test_case_in)
peptidoform.rename_modifications(label_mapping)
assert peptidoform.proforma == expected_out
+
+
+def test_format_number_as_string():
+ test_cases = [
+ (1212.12, "+1212.12"),
+ (-1212.12, "-1212.12"),
+ (0.1, "+0.1"),
+ (-0.1, "-0.1"),
+ (1212.000, "+1212"),
+ (1212.1200, "+1212.12"),
+ ]
+
+ for test_case_in, expected_out in test_cases:
+ assert _format_number_as_string(test_case_in) == expected_out
| Updating metaValues of PeptideHits with numpy objects crashes in idxml writer
After rescoring with ms2rescore the `rescoring_features` values can contain various types:
`{<class 'numpy.int8'>, <class 'float'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'int'>, <class 'numpy.int64'>}
`
[PeptideHit.setMetaValues](https://pyopenms.readthedocs.io/en/latest/apidocs/_autosummary/pyopenms/pyopenms.PeptideHit.html#pyopenms.PeptideHit.setMetaValue) however, does only allow ` in_1: int | float | bytes | str | List[int] | List[float] | List[bytes]` as values. This then causes errors when writing / updating idXML files.
I suggest converting to `float` if value is not type `str` | 0.0 | 37163f14360e31e6cbc3ea930418a799124c4b4f | [
"tests/test_peptidoform.py::TestPeptidoform::test_rename_modifications",
"tests/test_peptidoform.py::test_format_number_as_string"
]
| [
"tests/test_peptidoform.py::TestPeptidoform::test__len__",
"tests/test_peptidoform.py::TestPeptidoform::test__iter__"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2023-10-29 15:05:26+00:00 | apache-2.0 | 1,663 |
|
con__tributors-68 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3901cb9..aa0b97f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip.
## [0.0.x](https://github.com/con/tributors/tree/master) (0.0.x)
+ - fix mailmap parsing which could have lead to "too many values unpack" (0.0.22)
- add to action ability to run command twice (0.0.21)
- searching orcid for other-names as final resort, requiring first/last (0.0.19)
- searching for last, first and reverse for orcid lookup (0.0.18)
diff --git a/tributors/main/parsers/codemeta.py b/tributors/main/parsers/codemeta.py
index 34bb769..ebbe7f3 100644
--- a/tributors/main/parsers/codemeta.py
+++ b/tributors/main/parsers/codemeta.py
@@ -63,7 +63,7 @@ class CodeMetaParser(ParserBase):
def update_metadata(self):
"""Update codemeta metadata from the repository, if we can."""
- self.data["keywords"] = self.repo.topics(self.data["keywords"])
+ self.data["keywords"] = self.repo.topics(self.data.get("keywords", []))
self.data["description"] = self.data.get("description") or self.repo.description
self.data["codeRepository"] = (
self.data.get("codeRepository") or self.repo.html_url
diff --git a/tributors/main/parsers/mailmap.py b/tributors/main/parsers/mailmap.py
index 280e973..560c594 100644
--- a/tributors/main/parsers/mailmap.py
+++ b/tributors/main/parsers/mailmap.py
@@ -1,6 +1,6 @@
"""
-Copyright (C) 2020 Vanessa Sochat.
+Copyright (C) 2020-2022 Vanessa Sochat.
This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
@@ -38,9 +38,21 @@ class MailmapParser(ParserBase):
sys.exit("%s does not exist" % self.filename)
for line in read_file(self.filename):
- name, email = line.split("<")
- email = email.strip().rstrip(">")
- self.data[email] = {"name": name.strip()}
+
+ # keep track of the previous name, in case multiple per line
+ name = None
+
+ # mailmap line can have more than one entry, split by right >
+ for entry in line.strip().split(">"):
+ if not entry:
+ continue
+ new_name, email = map(str.strip, entry.split("<"))
+ # only the first name matters
+ if not name and new_name:
+ name = new_name
+ if not name:
+ raise ValueError(f"Could not figure out name in {line!r}")
+ self.data[email] = {"name": name}
return self.data
@property
diff --git a/tributors/version.py b/tributors/version.py
index cc2394b..c92b6f8 100644
--- a/tributors/version.py
+++ b/tributors/version.py
@@ -8,7 +8,7 @@ with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
-__version__ = "0.0.21"
+__version__ = "0.0.22"
AUTHOR = "Vanessa Sochat"
AUTHOR_EMAIL = "[email protected]"
NAME = "tributors"
| con/tributors | d8f3cdb3933826202231f24513d4fb62ab590135 | diff --git a/tests/test_mailmap.py b/tests/test_mailmap.py
new file mode 100644
index 0000000..27ea0c4
--- /dev/null
+++ b/tests/test_mailmap.py
@@ -0,0 +1,30 @@
+from tributors.main.parsers.mailmap import MailmapParser
+
+import pytest
+
+
+def test_simple(tmp_path):
+ mailmap = tmp_path / ".mailmap"
+ mailmap.write_text("""
+Joe Smith <[email protected]>
+Neuroimaging Community <[email protected]>
+Neuroimaging Community <[email protected]> blah <[email protected]>
+Neuroimaging Community <[email protected]> <[email protected]>""")
+ parser = MailmapParser(str(mailmap))
+ r = parser.load_data()
+ assert r == {
+ '[email protected]': {'name': 'Joe Smith'},
+ '[email protected]': {'name': 'Neuroimaging Community'},
+ '[email protected]': {'name': 'Neuroimaging Community'},
+ '[email protected]': {'name': 'Neuroimaging Community'}
+ }
+
+
+def test_noname(tmp_path):
+ mailmap = tmp_path / ".mailmap"
+ l = " <[email protected]>"
+ mailmap.write_text(l)
+ with pytest.raises(ValueError) as cme:
+ r = MailmapParser(str(mailmap)).load_data()
+ assert l in str(cme.value)
+
diff --git a/tests/test_orcid.py b/tests/test_orcid.py
index 89f083e..0c228d1 100644
--- a/tests/test_orcid.py
+++ b/tests/test_orcid.py
@@ -40,5 +40,5 @@ def test_queries(tmp_path):
# TODO this looks like the API is changed
# Test find by other-names (can't do because more than one result)
- # result = get_orcid(email=None, name="Horea Christian")
- # assert result == "0000-0001-7037-2449"
+ result = get_orcid(email=None, name="Chris Gorgolewski")
+ assert result == "0000-0003-3321-7583"
| update-lookup: crashes with "ValueError: too many values to unpack" on .mailmap parsin
```shell
(git)lena:~datalad/datalad-master[master]git
$> tributors update-lookup
INFO:allcontrib:Updating .tributors cache from .all-contributorsrc
INFO: zenodo:Updating .tributors cache from .zenodo.json
INFO: mailmap:Updating .tributors cache from .mailmap
Traceback (most recent call last):
File "/home/yoh/proj/tributors/venvs/dev3/bin/tributors", line 33, in <module>
sys.exit(load_entry_point('tributors', 'console_scripts', 'tributors')())
File "/home/yoh/proj/tributors/tributors/client/__init__.py", line 175, in main
main(args, extra)
File "/home/yoh/proj/tributors/tributors/client/lookup.py", line 52, in main
client.update_resource(resources=resources, params=extra)
File "/home/yoh/proj/tributors/tributors/main/__init__.py", line 97, in update_resource
resource.update_lookup()
File "/home/yoh/proj/tributors/tributors/main/parsers/mailmap.py", line 63, in update_lookup
self.load_data()
File "/home/yoh/proj/tributors/tributors/main/parsers/mailmap.py", line 41, in load_data
name, email = line.split("<")
ValueError: too many values to unpack (expected 2)
(dev3) 1 15113 ->1.....................................:Wed 18 Aug 2021 09:53:20 AM EDT:.
(git)lena:~datalad/datalad-master[master]git
$> git describe
0.14.7-544-g379d4e2f9
changes on filesystem:
.github/workflows/update-contributors.yml | 2 +-
(dev3) 1 15114.....................................:Wed 18 Aug 2021 09:54:31 AM EDT:.
(git)lena:~datalad/datalad-master[master]git
$> tributors --version
0.0.19
changes on filesystem:
.github/workflows/update-contributors.yml | 2 +-
(dev3) 1 15115.....................................:Wed 18 Aug 2021 09:54:34 AM EDT:.
(git)lena:~datalad/datalad-master[master]git
$> cat .mailmap
Alejandro de la Vega <[email protected]>
Alex Waite <[email protected]> Alex Waite <[email protected]>
Andy Connolly <[email protected]> <[email protected]>
Anisha Keshavan <[email protected]>
Benjamin Poldrack <[email protected]> <[email protected]>
Christian Mönch <[email protected]> Christian Moench <[email protected]>
Christian Olaf Häusler <[email protected]> chris <[email protected]>
Dave MacFarlane <[email protected]> Dave MacFarlane <[email protected]>
Dave MacFarlane <[email protected]> Dave MacFarlane <[email protected]>
Debanjum Singh Solanky <[email protected]> Debanjum <[email protected]> debanjum <[email protected]>
Gergana Alteva <[email protected]> Gergana Alteva <[email protected]>
Jason Gors <[email protected]>
John T. Wodder II <[email protected]> <[email protected]>
Kusti Skytén <[email protected]> <[email protected]>
Michael Hanke <[email protected]> mih <mih>
Neuroimaging Community <[email protected]> blah <[email protected]>
Neuroimaging Community <[email protected]> <[email protected]>
Neuroimaging Community <[email protected]> unknown <[email protected]>
Taylor Olson <[email protected]> Taylor Olson <[email protected]>
Torsten Stoeter <[email protected]>
Vanessa Sochat <[email protected]>
Yaroslav Halchenko <[email protected]>
Yaroslav Halchenko <[email protected]> <[email protected]>
Yaroslav Halchenko <[email protected]> <[email protected]>
``` | 0.0 | d8f3cdb3933826202231f24513d4fb62ab590135 | [
"tests/test_mailmap.py::test_simple",
"tests/test_mailmap.py::test_noname"
]
| [
"tests/test_orcid.py::test_queries"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-06-18 16:28:27+00:00 | apache-2.0 | 1,664 |
|
conchyliculture__beerlog-14 | diff --git a/beerlog/beerlogdb.py b/beerlog/beerlogdb.py
index ad83992..3df6f5c 100644
--- a/beerlog/beerlogdb.py
+++ b/beerlog/beerlogdb.py
@@ -19,52 +19,22 @@ class BeerModel(peewee.Model):
"""Sets Metadata for the database."""
database = database_proxy
-
-def BeerPerCharacter(character, amount):
- """Helper function to generate the SQL expression for the total amount
- of beer drunk."""
- return peewee.Expression(character.glass, '*', amount)
-
-
-class Character(BeerModel):
- """class for one Character in the BeerLog database."""
- hexid = peewee.CharField()
- glass = peewee.IntegerField(default=constants.DEFAULT_GLASS_SIZE)
-
- @property
- def name(self):
- """Gets the corresponding name from hexid using the parent db object
- method."""
- return self._meta.database.GetNameFromHexID(self.hexid)
-
- def GetAmountDrunk(self, at=None):
- """Gets the amount of beer drunk."""
- return self._meta.database.GetAmountFromHexID(self.hexid, self.glass, at=at)
-
-
-
class Entry(BeerModel):
"""class for one Entry in the BeerLog database."""
- character = peewee.ForeignKeyField(Character, backref='entries')
+ character_name = peewee.CharField()
+ amount = peewee.IntegerField(default=constants.DEFAULT_GLASS_SIZE)
timestamp = peewee.DateTimeField(default=datetime.now)
pic = peewee.CharField(null=True)
class BeerLogDB():
"""Wrapper for the database."""
- _DEFAULT_GLASS_SIZE = 50
-
def __init__(self, database_path):
self.database_path = database_path
sqlite_db = peewee.SqliteDatabase(self.database_path)
database_proxy.initialize(sqlite_db)
- # This is used for the Character.name property
- sqlite_db.GetNameFromHexID = self.GetNameFromHexID
- # This is used for the Character.GetAmountDrink() method
- sqlite_db.GetAmountFromHexID = self.GetAmountFromHexID
-
- sqlite_db.create_tables([Character, Entry], safe=True)
+ sqlite_db.create_tables([Entry], safe=True)
self.known_tags_list = None
@@ -76,7 +46,7 @@ class BeerLogDB():
"""Closes the database."""
database_proxy.close()
- def AddEntry(self, character_hexid, pic, time=None):
+ def AddEntry(self, character_hexid, pic=None, time=None):
"""Inserts an entry in the database.
Args:
@@ -87,36 +57,27 @@ class BeerLogDB():
Returns:
Entry: the Entry that was stored in the database.
"""
- glass = self.GetGlassFromHexID(character_hexid)
- character, _ = Character.get_or_create(hexid=character_hexid, glass=glass)
+ amount = self.GetGlassFromHexID(character_hexid)
+ character_name = self.GetNameFromHexID(character_hexid)
if time:
entry = Entry.create(
- character=character,
+ character_name=character_name,
+ amount=amount,
timestamp=time,
pic=pic
)
else:
entry = Entry.create(
- character=character,
+ character_name=character_name,
+ amount=amount,
pic=pic
)
return entry
- def GetAllCharacters(self):
+ def GetAllCharacterNames(self):
"""Gets all active characters."""
- query = Character.select(Character).join(Entry).where(
- Character.id == Entry.character_id).distinct()
- return query
-
- def GetCharacterFromHexID(self, character_hexid):
- """Returns a Character from its hexid.
-
- Args:
- character_hexid(str): the character's hexid.
- Returns:
- Character: a Character object, or None.
- """
- return Character.get_or_none(Character.hexid == character_hexid)
+ query = Entry.select(Entry.character_name).distinct()
+ return [entry.character_name for entry in query.execute()]
def GetEntryById(self, entry_id):
"""Returns an Entry by its primary key.
@@ -149,14 +110,14 @@ class BeerLogDB():
"""
query = Entry.select(
Entry,
- Character,
+ peewee.fn.SUM(Entry.amount).alias('total'),
peewee.fn.MAX(Entry.timestamp).alias('last'),
- BeerPerCharacter(Character, peewee.fn.COUNT()).alias('amount')
- ).join(Character).group_by(Entry.character).order_by(
- BeerPerCharacter(Character, peewee.fn.COUNT()).desc(),
- (peewee.fn.MAX(Entry.timestamp)).desc()
+ ).group_by(
+ Entry.character_name
+ ).order_by(
+ peewee.SQL('total').desc(),
+ (peewee.fn.MAX(Entry.timestamp)).asc(),
)
-
return query
def GetGlassFromHexID(self, uid):
@@ -166,12 +127,14 @@ class BeerLogDB():
uid(str): the uid in form 0x0580000000050002
Returns:
int: the glass size for a tag uid, or the default value if not found.
+ Raises:
+ errors.BeerLogError: if the uid can't be found.
"""
tag_object = self.known_tags_list.get(uid)
if not tag_object:
- return self._DEFAULT_GLASS_SIZE
+ raise errors.BeerLogError('Unknown character for tag {0:s}'.format(uid))
- return tag_object.get('glass', self._DEFAULT_GLASS_SIZE)
+ return tag_object.get('glass', constants.DEFAULT_GLASS_SIZE)
def LoadTagsDB(self, known_tags_path):
"""Loads the external known tags list.
@@ -200,12 +163,13 @@ class BeerLogDB():
Args:
uid(str): the uid in form 0x0580000000050002
Returns:
- str: the corresponding name for that tag uid, or None if no name is found.
+ str: the corresponding name for that tag uid.
+ Raises:
+ errors.BeerLogError: if the uid can't be found.
"""
tag_object = self.known_tags_list.get(uid)
if not tag_object:
- return None
-
+ raise errors.BeerLogError('Unknown character for tag {0:s}'.format(uid))
return tag_object.get('realname') or tag_object.get('name')
def GetEarliestTimestamp(self):
@@ -216,27 +180,38 @@ class BeerLogDB():
"""Returns the timestamp of the last scan."""
return Entry.select(peewee.fn.MAX(Entry.timestamp)).scalar() #pylint: disable=no-value-for-parameter
- def GetAmountFromHexID(self, hexid, glass_size, at=None):
+ def GetAmountFromHexID(self, hexid, at=None):
"""Returns the amount of beer drunk for a Character.
Args:
hexid(str): the hexid of a character.
- glass_size(int): the size of the character's glass.
at(datetime.datetime): optional maximum date to count scans.
Returns:
int: the amount of beer.
"""
- character = self.GetCharacterFromHexID(hexid)
+ character_name = self.GetNameFromHexID(hexid)
+ return self.GetAmountFromName(character_name, at=at)
+
+ def GetAmountFromName(self, name, at=None):
+ """Returns the amount of beer drunk for a character.
+
+ Args:
+ name(str): the name of a character.
+ at(datetime.datetime): optional maximum date to count scans.
+ Returns:
+ int: the amount of beer.
+ """
amount_cl = 0
- if character:
- if at:
- entries = Entry.select(Entry).where(
- Entry.character == character,
- Entry.timestamp <= at).count()
- else:
- entries = Entry.select(Entry).where(
- Entry.character == character).count()
- amount_cl = entries * glass_size
+ if at:
+ query = Entry.select(peewee.fn.SUM(Entry.amount)).where(
+ Entry.character_name == name,
+ Entry.timestamp <= at)
+ else:
+ query = Entry.select(peewee.fn.SUM(Entry.amount)).where(
+ Entry.character_name == name)
+ amount = query.scalar()
+ if amount:
+ amount_cl = amount
return amount_cl
# vim: tabstop=2 shiftwidth=2 expandtab
diff --git a/beerlog/cli/beerlog_cli.py b/beerlog/cli/beerlog_cli.py
index 0b8a84d..1cfb5af 100644
--- a/beerlog/cli/beerlog_cli.py
+++ b/beerlog/cli/beerlog_cli.py
@@ -15,7 +15,6 @@ import time
from beerlog import beerlogdb
from beerlog.bnfc import base as nfc_base
from beerlog import constants
-from beerlog import errors
from beerlog import events
from beerlog.gui import display
@@ -185,14 +184,9 @@ class BeerLog():
# TODO : have a UI class of events, and let the ui object deal with them
self.ResetTimers()
if event.type == constants.EVENTTYPES.NFCSCANNED:
- name = self.db.GetNameFromHexID(event.uid)
- if not name:
- raise errors.BeerLogError(
- 'Could not find the corresponding name for tag id "{0!s}" '
- 'in "{1:s}"'.format(event.uid, self._known_tags))
- character = self.db.GetCharacterFromHexID(event.uid)
self.db.AddEntry(event.uid, self._last_taken_picture)
- self.ui.machine.scan(who=name, character=character)
+ name = self.db.GetNameFromHexID(event.uid)
+ self.ui.machine.scan(who=name)
self.AddDelayedEvent(events.UIEvent(constants.EVENTTYPES.ESCAPE), 2)
elif event.type == constants.EVENTTYPES.KEYUP:
self.ui.machine.up()
diff --git a/beerlog/gui/display.py b/beerlog/gui/display.py
index a535687..08481b5 100644
--- a/beerlog/gui/display.py
+++ b/beerlog/gui/display.py
@@ -1,4 +1,5 @@
-"""TODO"""
+"""Module for managing the display."""
+
from __future__ import print_function
from datetime import datetime
@@ -15,7 +16,13 @@ from beerlog import errors
def GetShortAmountOfBeer(amount):
- """Returns a shortened string for an volume in cL."""
+ """Returns a shortened string for an volume in cL
+
+ Args:
+ amount(float): quantity, in L.
+ Returns:
+ str: the human readable string.
+ """
if amount >= 999.5:
return 'DED'
if amount >= 99.5:
@@ -24,7 +31,15 @@ def GetShortAmountOfBeer(amount):
def GetShortLastBeer(last, now=None):
- """Returns a shortened string for the last scan."""
+ """Returns a shortened string for the delta between now and last scan.
+
+ Args:
+ last(datetime.datetime): timestamp of the last scan.
+ now(datetime.datetime): an optional time reference.
+ The current datetime if None.
+ Returns:
+ str: the time delta since the last scan and now.
+ """
if not now:
now = datetime.now()
delta = now - last
@@ -52,6 +67,7 @@ def GetShortLastBeer(last, now=None):
result = 'Unk?'
return '{0: >4}'.format(result[0:4])
+
class ScoreBoard():
"""Implements a sliding window with a selector over the score board."""
@@ -103,15 +119,14 @@ class ScoreBoard():
class LumaDisplay():
- """TODO"""
+ """Class managing the display."""
STATES = ['SPLASH', 'SCORE', 'STATS', 'SCANNED', 'ERROR']
DEFAULT_SPLASH_PIC = 'assets/pics/splash_small.png'
DEFAULT_SCAN_GIF = 'assets/gif/beer_scanned.gif'
- # TODO: remove the default None here
- def __init__(self, events_queue=None, database=None):
+ def __init__(self, events_queue, database):
self._events_queue = events_queue
self._database = database
if not self._events_queue:
@@ -122,8 +137,7 @@ class LumaDisplay():
# Internal stuff
self.luma_device = None
self.machine = None
- self._last_scanned = None
- self._last_scanned_character = None
+ self._last_scanned_name = None
self._last_error = None
# UI related defaults
@@ -195,8 +209,7 @@ class LumaDisplay():
Args:
event(transitions.EventData): the event.
"""
- self._last_scanned = event.kwargs.get('who', None)
- self._last_scanned_character = event.kwargs.get('character', None)
+ self._last_scanned_name = event.kwargs.get('who', None)
self._last_error = event.kwargs.get('error', None)
self._scoreboard = ScoreBoard(self._database.GetScoreBoard())
@@ -220,11 +233,10 @@ class LumaDisplay():
(self.luma_device.width - size[0]) // 2,
self.luma_device.height - size[1]
)
- msg = 'Cheers ' + self._last_scanned + '!'
- if self._last_scanned_character:
- msg += ' {0:s}L'.format(
- GetShortAmountOfBeer(
- self._last_scanned_character.GetAmountDrunk() / 100.0))
+ msg = 'Cheers ' + self._last_scanned_name + '!'
+ msg += ' {0:s}L'.format(
+ GetShortAmountOfBeer(
+ self._database.GetAmountFromName(self._last_scanned_name) / 100.0))
for gif_frame in PIL.ImageSequence.Iterator(beer):
with regulator:
@@ -263,8 +275,8 @@ class LumaDisplay():
# '2.Dog 10 5m'
text = str(scoreboard_position)+'.'
text += ' '.join([
- ('{0:<'+str(max_name_width)+'}').format(row.character.name),
- GetShortAmountOfBeer(row.amount / 100.0),
+ ('{0:<'+str(max_name_width)+'}').format(row.character_name),
+ GetShortAmountOfBeer(row.total / 100.0),
GetShortLastBeer(row.last)])
if self._scoreboard.index == scoreboard_position:
rectangle_geometry = (
diff --git a/beerlog/gui/sh1106.py b/beerlog/gui/sh1106.py
index d1caddd..8f7b5ce 100644
--- a/beerlog/gui/sh1106.py
+++ b/beerlog/gui/sh1106.py
@@ -106,7 +106,7 @@ class WaveShareOLEDHat():
self._oled_hat = sh1106(self._serial, rotate=0)
def GetDevice(self):
- """Returns the """
+ """Returns the luma device"""
return self._oled_hat
# vim: tabstop=2 shiftwidth=2 expandtab
diff --git a/tools/web.py b/tools/web.py
index 4e20ce8..8ac1203 100644
--- a/tools/web.py
+++ b/tools/web.py
@@ -73,10 +73,9 @@ class Handler(http.server.BaseHTTPRequestHandler):
db.LoadTagsDB('/home/renzokuken/known_tags.json')
first_scan = db.GetEarliestTimestamp()
- first_scan = first_scan.replace(hour=16, minute=0, second=0)
+ first_scan = first_scan.replace(hour=16, minute=0, second=0) # Clean up hack
last_scan = db.GetLatestTimestamp()
delta = last_scan - first_scan
- print(last_scan)
total_hours = int((delta.total_seconds() / 3600) + 2)
fields = []
datasets = {} # {'alcoolique': ['L cummulés']}
@@ -84,12 +83,12 @@ class Handler(http.server.BaseHTTPRequestHandler):
timestamp = (first_scan + datetime.timedelta(seconds=hour * 3600))
timestamp = timestamp.replace(tzinfo=datetime.timezone.utc)
fields.append(timestamp.astimezone().strftime('%Y%m%d %Hh%M'))
- for alcoolique in db.GetAllCharacters():
- cl = alcoolique.GetAmountDrunk(at=timestamp)
- if alcoolique.name in datasets:
- datasets[alcoolique.name].append(cl)
+ for alcoolique in db.GetAllCharacterNames():
+ cl = db.GetAmountFromName(alcoolique, at=timestamp)
+ if alcoolique in datasets:
+ datasets[alcoolique].append(cl)
else:
- datasets[alcoolique.name] = [cl]
+ datasets[alcoolique] = [cl]
output_datasets = [] # [{'label': 'alcoolique', 'data': ['L cummulés']}]
for k, v in datasets.items():
| conchyliculture/beerlog | f28922ed463ccd77a9cfc1fed85cd2d3a4ab3b28 | diff --git a/beerlog/beerlogdb_tests.py b/beerlog/beerlogdb_tests.py
index e70d587..934023f 100644
--- a/beerlog/beerlogdb_tests.py
+++ b/beerlog/beerlogdb_tests.py
@@ -4,10 +4,12 @@ from __future__ import unicode_literals
import datetime
import json
+import os
import tempfile
import unittest
from beerlog import beerlogdb
+from beerlog import errors
# pylint: disable=protected-access
@@ -16,137 +18,109 @@ class BeerLogDBTests(unittest.TestCase):
DB_PATH = ':memory:'
+ def setUp(self):
+ self.db = beerlogdb.BeerLogDB(self.DB_PATH)
+ self.db.known_tags_list = {
+ '0x0': {'name': 'toto', 'glass': 33},
+ '0x1': {'name': 'toto', 'glass': 45},
+ '0x2': {'name': 'tutu', 'glass': 50},
+ '0x3': {'name': 'tata', 'glass': 40},
+ '0x4': {'name': 'titi', 'glass': 40}
+ }
+
+ def tearDown(self):
+ if self.DB_PATH != ':memory:':
+ os.remove(self.DB_PATH)
+
def testAddEntry(self):
"""Tests the AddEntry() method."""
- db = beerlogdb.BeerLogDB(self.DB_PATH)
- db.known_tags_list = {
- 'char1': {'name': 'toto', 'glass': 33},
- }
- db.AddEntry('char1', 'pic1')
- db.AddEntry('char1', 'pic1')
- self.assertEqual(db.CountAll(), 2)
-
- def testGetCharacterFromHexID(self):
+ self.db.AddEntry('0x0')
+ self.db.AddEntry('0x0')
+ self.assertEqual(self.db.CountAll(), 2)
+
+ def testGetNameFromHexID(self):
"""Tests the CharacterFromHexID() method."""
- db = beerlogdb.BeerLogDB(self.DB_PATH)
- db.known_tags_list = {
- 'charX': {'name': 'toto', 'glass': 33},
- 'charY': {'name': 'toto', 'glass': 45}
- }
- db.AddEntry('charX', 'picX')
- self.assertEqual(db.GetCharacterFromHexID('non-ex'), None)
+ result = self.db.GetNameFromHexID('0x0')
+ self.assertEqual(result, 'toto')
- result = db.GetCharacterFromHexID('charX')
- self.assertEqual(result.glass, 33)
+ result = self.db.GetNameFromHexID('0x1')
+ self.assertEqual(result, 'toto')
def testGetScoreBoard(self):
"""Tests the GetScoreBoard method."""
- db = beerlogdb.BeerLogDB(self.DB_PATH)
- db.known_tags_list = {
- 'a': {'name': 'toto', 'glass': 33},
- 'b': {'name': 'toto', 'glass': 45}
- }
- db.AddEntry('a', 'pic1')
- db.AddEntry('a', 'pic2')
- db.AddEntry('a', 'pic3')
- db.AddEntry('a', 'pic4')
- db.AddEntry('b', 'pic1')
- db.AddEntry('b', 'pic2')
- db.AddEntry('a', 'pic6')
- db.AddEntry('b', 'pic2')
-
- char_a = db.GetCharacterFromHexID('a')
- char_b = db.GetCharacterFromHexID('b')
- expected = [(7, char_a, 5 * 33, u'pic6'), (8, char_b, 3 * 45, u'pic2')]
+ self.db.AddEntry('0x0')
+ self.db.AddEntry('0x0')
+ self.db.AddEntry('0x0')
+ self.db.AddEntry('0x1')
+ self.db.AddEntry('0x1')
+ self.db.AddEntry('0x4')
+ self.db.AddEntry('0x2')
+ self.db.AddEntry('0x1')
+ self.db.AddEntry('0x2')
+ self.db.AddEntry('0x3')
+
+ expected = [
+ ('toto', 3 * 33 + 3 * 45, None),
+ ('tutu', 2 * 50, None),
+ ('titi', 1 * 40, None),# Same amount, but oldest first
+ ('tata', 1 * 40, None)
+ ]
results = [
- (t.id, t.character, t.amount, t.pic)
- for t in db.GetScoreBoard().execute()]
- self.assertEqual(expected, results)
-
- db = beerlogdb.BeerLogDB(self.DB_PATH)
- db.known_tags_list = {
- 'a': {'name': 'toto', 'glass': 33},
- 'b': {'name': 'toto', 'glass': 45}
- }
- # Same amount, most recent first
- db.AddEntry('a', 'pic2')
- db.AddEntry('b', 'pic2')
- char_a = db.GetCharacterFromHexID('a')
- char_b = db.GetCharacterFromHexID('b')
- expected = [(2, char_b, 1 * 45, u'pic2'), (1, char_a, 1 * 33, u'pic2')]
- results = [
- (t.id, t.character, t.amount, t.pic)
- for t in db.GetScoreBoard().execute()]
+ (t.character_name, t.total, t.pic)
+ for t in self.db.GetScoreBoard().execute()]
self.assertEqual(expected, results)
def testGetCharacters(self):
"""Test tags name/hexid operations."""
- db = beerlogdb.BeerLogDB(self.DB_PATH)
- db.known_tags_list = {
- '0x0': {'name': 'toto', 'glass': 33},
- '0x2': {'name': 'tutu', 'glass': 45}
- }
- db.AddEntry('0x0', 'pic2')
- db.AddEntry('0x2', 'pic2')
-
- char_a = db.GetCharacterFromHexID('0x0')
- char_b = db.GetCharacterFromHexID('0x2')
- self.assertEqual(
- [char_a, char_b],
- [t for t in db.GetAllCharacters().execute()])
+ self.db.AddEntry('0x0', 'pic2')
+ self.db.AddEntry('0x2', 'pic2')
+ self.assertEqual(['toto', 'tutu'], self.db.GetAllCharacterNames())
def testGetAmount(self):
"""Tests for counting total amount drunk per character"""
- db = beerlogdb.BeerLogDB(self.DB_PATH)
- db.known_tags_list = {
- '0x0': {'name': 'toto', 'glass': 33},
- '0x2': {'name': 'toto', 'glass': 45}
- }
- db.AddEntry('0x0', '', time=datetime.datetime(2019, 1, 1, 15, 00))
- db.AddEntry('0x0', '', time=datetime.datetime(2019, 1, 1, 16, 00))
- db.AddEntry('0x0', '', time=datetime.datetime(2019, 1, 1, 17, 00))
- db.AddEntry('0x2', '', time=datetime.datetime(2019, 1, 1, 14, 00))
- db.AddEntry('0x2', '', time=datetime.datetime(2019, 1, 1, 16, 30))
+ self.db.AddEntry('0x0', time=datetime.datetime(2019, 1, 1, 15, 00))
+ self.db.AddEntry('0x0', time=datetime.datetime(2019, 1, 1, 16, 00))
+ self.db.AddEntry('0x1', time=datetime.datetime(2019, 1, 1, 17, 00))
+ self.db.AddEntry('0x2', time=datetime.datetime(2019, 1, 1, 14, 00))
+ self.db.AddEntry('0x2', time=datetime.datetime(2019, 1, 1, 16, 30))
self.assertEqual(
- datetime.datetime(2019, 1, 1, 14, 0), db.GetEarliestTimestamp())
+ datetime.datetime(2019, 1, 1, 14, 0), self.db.GetEarliestTimestamp())
self.assertEqual(
- datetime.datetime(2019, 1, 1, 17, 0), db.GetLatestTimestamp())
-
- # 3 scans
- self.assertEqual(3*12, db.GetAmountFromHexID('0x0', 12))
-
- self.assertEqual(0, db.GetAmountFromHexID(
- '0x0', 12, at=datetime.datetime(2018, 1, 1, 16, 30)))
- self.assertEqual(2*12, db.GetAmountFromHexID(
- '0x0', 12, at=datetime.datetime(2019, 1, 1, 16, 30)))
+ datetime.datetime(2019, 1, 1, 17, 0), self.db.GetLatestTimestamp())
+ # 3 scans: 2 with 33 & 1 with 45
+ self.assertEqual(2 * 33 + 1 * 45, self.db.GetAmountFromHexID('0x0'))
+ # Date too old, getting nothing
+ self.assertEqual(0, self.db.GetAmountFromHexID(
+ '0x0', at=datetime.datetime(2018, 1, 1, 16, 30)))
+ # One scan
+ self.assertEqual(1 * 50, self.db.GetAmountFromHexID(
+ '0x2', at=datetime.datetime(2019, 1, 1, 15, 30)))
- def testTags(self):
- """Test tags name/hexid operations."""
- db = beerlogdb.BeerLogDB(self.DB_PATH)
- db.known_tags_list = {
- '0x0': {'name': 'toto', 'glass': 33},
- '0x2': {'name': 'toto', 'glass': 45}
- }
- db.AddEntry('0x0', '')
- db.AddEntry('0x2', '')
+ def testLoadTags(self):
+ """Test loading the name/hexid json file."""
with tempfile.NamedTemporaryFile(mode='w+') as temp:
temp.write(json.dumps({
'0x0':{'name': 'Kikoo', 'glass': '30'},
'0x2':{'name': 'name', 'realname': 'realname', 'glass': '45'}}))
temp.flush()
- db.LoadTagsDB(temp.name)
- l = db.known_tags_list
+ self.db.LoadTagsDB(temp.name)
+ l = self.db.known_tags_list
self.assertEqual(2, len(l))
- self.assertEqual('Kikoo', db.GetNameFromHexID('0x0'))
- self.assertEqual('realname', db.GetNameFromHexID('0x2'))
+ self.assertEqual('Kikoo', self.db.GetNameFromHexID('0x0'))
+ self.assertEqual('realname', self.db.GetNameFromHexID('0x2'))
+
+ with self.assertRaises(errors.BeerLogError):
+ self.assertEqual(None, self.db.GetNameFromHexID('0x1'))
+
+ self.assertEqual(self.db.GetNameFromHexID('0x0'), 'Kikoo')
+ self.assertEqual(self.db.GetNameFromHexID('0x2'), 'realname')
- self.assertEqual(None, db.GetNameFromHexID('0x1'))
- self.assertEqual(db.GetCharacterFromHexID('0x0').name, 'Kikoo')
- self.assertEqual(db.GetCharacterFromHexID('0x2').name, 'realname')
+if __name__ == "__main__":
+ unittest.main()
| when in a tie of quantity, reward the one who got there first | 0.0 | f28922ed463ccd77a9cfc1fed85cd2d3a4ab3b28 | [
"beerlog/beerlogdb_tests.py::BeerLogDBTests::testAddEntry",
"beerlog/beerlogdb_tests.py::BeerLogDBTests::testGetAmount",
"beerlog/beerlogdb_tests.py::BeerLogDBTests::testGetCharacters",
"beerlog/beerlogdb_tests.py::BeerLogDBTests::testGetScoreBoard",
"beerlog/beerlogdb_tests.py::BeerLogDBTests::testLoadTags"
]
| [
"beerlog/beerlogdb_tests.py::BeerLogDBTests::testGetNameFromHexID"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2019-08-31 10:03:21+00:00 | mit | 1,669 |
|
conda__conda-pack-151 | diff --git a/conda_pack/core.py b/conda_pack/core.py
index 7dd06d5..b759ee3 100644
--- a/conda_pack/core.py
+++ b/conda_pack/core.py
@@ -649,7 +649,7 @@ def read_has_prefix(path):
def load_files(prefix):
from os.path import relpath, join, isfile, islink
- ignore = {'pkgs', 'envs', 'conda-bld', '.conda_lock', 'users', 'info',
+ ignore = {'pkgs', 'envs', 'conda-bld', '.conda_lock', 'users',
'conda-recipes', '.index', '.unionfs', '.nonadmin', 'python.app',
'Launcher.app'}
| conda/conda-pack | 7e7585b0ac73f37fabb0ee309455df0cffeede00 | diff --git a/testing/env_yamls/has_conda.yml b/testing/env_yamls/has_conda.yml
index 50ad03d..dd33147 100644
--- a/testing/env_yamls/has_conda.yml
+++ b/testing/env_yamls/has_conda.yml
@@ -3,4 +3,3 @@ name: has_conda
dependencies:
- conda
- toolz
- - python=3.7
| continue to ignore `info` in `load_files()` or just use `--ignore-missing-files`?
The following error broke our nightlies a few nights ago:
```
$ conda pack --format tar.gz -j -1
Collecting packages...
CondaPackError:
Files managed by conda were found to have been deleted/overwritten in the
following packages:
- python='3.8.5'
This is usually due to `pip` uninstalling or clobbering conda managed files,
resulting in an inconsistent environment. Please check your environment for
conda/pip conflicts using `conda list`, and fix the environment by ensuring
only one version of each package is installed (conda preferred).
```
Debugging `core.py`, I found this following entry in `paths.json` is the root cause:
```
$ pwd
/export/home/ops/conda/pkgs/python-3.8.5-h7579374_1/info
$ diff paths.json.orig paths.json
900,905d899
< "_path": "info/info_json.d/security.json",
< "path_type": "hardlink",
< "sha256": "1eba042cbb28d2403ca77fbdd8fb7ca518d65b0522a13730255ffdef694a826a",
< "size_in_bytes": 1773
< },
< {
```
2 ways to solve the error:
1. Use `--ignore-missing-files`
1. Remove `info` from `load_files`: https://github.com/conda/conda-pack/blob/master/conda_pack/core.py#L585
What do you all recommend? | 0.0 | 7e7585b0ac73f37fabb0ee309455df0cffeede00 | [
"conda_pack/tests/test_formats.py::test_format[tar.gz-False]",
"conda_pack/tests/test_formats.py::test_format_parallel[tar.gz]",
"conda_pack/tests/test_formats.py::test_n_threads",
"conda_pack/tests/test_formats.py::test_format_parallel[tar.bz2]",
"conda_pack/tests/test_formats.py::test_format[tar.bz2-False]",
"conda_pack/tests/test_formats.py::test_format[zip-False]",
"conda_pack/tests/test_formats.py::test_format[tar-False]",
"conda_pack/tests/test_core.py::test_name_to_prefix",
"conda_pack/tests/test_core.py::test_errors_conda_missing",
"conda_pack/tests/test_core.py::test_zip64",
"conda_pack/tests/test_core.py::test_file"
]
| [
"conda_pack/tests/test_cli.py::test_cli_exceptions",
"conda_pack/tests/test_cli.py::test_help",
"conda_pack/tests/test_cli.py::test_parse_include_exclude",
"conda_pack/tests/test_cli.py::test_version"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2020-09-20 19:40:08+00:00 | bsd-3-clause | 1,670 |
|
conda__conda-pack-26 | diff --git a/conda_pack/core.py b/conda_pack/core.py
index 12478c2..c2b5655 100644
--- a/conda_pack/core.py
+++ b/conda_pack/core.py
@@ -659,6 +659,10 @@ def load_environment(prefix, unmanaged=True, on_missing_cache='warn'):
if not os.path.exists(conda_meta):
raise CondaPackException("Path %r is not a conda environment" % prefix)
+ # Check that it's not the root environment
+ if any(os.path.exists(os.path.join(prefix, d)) for d in ['pkgs', 'envs']):
+ raise CondaPackException("Cannot package root environment")
+
# Find the environment site_packages (if any)
site_packages = find_site_packages(prefix)
| conda/conda-pack | 4de05868865c3f8f5c592ee90fdff808cab44e36 | diff --git a/conda_pack/tests/test_core.py b/conda_pack/tests/test_core.py
index ccafe44..b2b7306 100644
--- a/conda_pack/tests/test_core.py
+++ b/conda_pack/tests/test_core.py
@@ -1,5 +1,6 @@
from __future__ import absolute_import, print_function, division
+import json
import os
import subprocess
import tarfile
@@ -62,6 +63,16 @@ def test_errors_editable_packages():
assert "Editable packages found" in str(exc.value)
+def test_errors_root_environment():
+ info = subprocess.check_output("conda info --json", shell=True).decode()
+ root_prefix = json.loads(info)['root_prefix']
+
+ with pytest.raises(CondaPackException) as exc:
+ CondaEnv.from_prefix(root_prefix)
+
+ assert "Cannot package root environment" in str(exc.value)
+
+
def test_env_properties(py36_env):
assert py36_env.name == 'py36'
assert py36_env.prefix == py36_path
| Properly handle root environment
The root environment is different than sub-environments in a couple key ways:
- The path contains extra directories like the package cache, `conda-bld` directory, etc...
- The environment contains conda itself, and may contain packages that depend on it (these are forbidden in sub-environments)
A few options for handling the root environment:
- Special case the handling to directories/files that shouldn't be packed, and packages that depend on conda
- Error nicely and tell the user to create a sub-environment
I'm not sure which would be more expected. The second is a lot easier to implement. | 0.0 | 4de05868865c3f8f5c592ee90fdff808cab44e36 | [
"conda_pack/tests/test_core.py::test_errors_root_environment"
]
| [
"conda_pack/tests/test_core.py::test_name_to_prefix",
"conda_pack/tests/test_core.py::test_file"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2018-07-05 23:30:52+00:00 | bsd-3-clause | 1,671 |
|
conda__conda-pack-50 | diff --git a/conda_pack/compat.py b/conda_pack/compat.py
index 782b167..7255849 100644
--- a/conda_pack/compat.py
+++ b/conda_pack/compat.py
@@ -5,13 +5,23 @@ on_win = sys.platform == 'win32'
if sys.version_info.major == 2:
+ from imp import load_source
+
def source_from_cache(path):
if path.endswith('.pyc') or path.endswith('.pyo'):
return path[:-1]
raise ValueError("Path %s is not a python bytecode file" % path)
else:
+ import importlib
from importlib.util import source_from_cache
+ def load_source(name, path):
+ loader = importlib.machinery.SourceFileLoader(name, path)
+ spec = importlib.util.spec_from_loader(loader.name, loader)
+ mod = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(mod)
+ return mod
+
def find_py_source(path, ignore=True):
"""Find the source file for a given bytecode file.
diff --git a/conda_pack/core.py b/conda_pack/core.py
index e561236..e4f1655 100644
--- a/conda_pack/core.py
+++ b/conda_pack/core.py
@@ -956,13 +956,18 @@ class Packer(object):
if not on_win:
shebang = '#!/usr/bin/env python'
+ python_pattern = re.compile(os.path.join(BIN_DIR, 'python\d.\d'))
else:
shebang = ('@SETLOCAL ENABLEDELAYEDEXPANSION & CALL "%~f0" & (IF '
'NOT ERRORLEVEL 1 (python -x "%~f0" %*) ELSE (ECHO No '
'python environment found on path)) & PAUSE & EXIT /B '
'!ERRORLEVEL!')
+ python_pattern = re.compile(os.path.join(BIN_DIR, 'python'))
- prefix_records = ',\n'.join(repr(p) for p in self.prefixes)
+ # We skip prefix rewriting in python executables (if needed)
+ # to avoid editing a running file.
+ prefix_records = ',\n'.join(repr(p) for p in self.prefixes
+ if not python_pattern.match(p[0]))
with open(os.path.join(_current_dir, 'prefixes.py')) as fil:
prefixes_py = fil.read()
| conda/conda-pack | f15da7b41c6c4a813fb9dae7797516aca69235fe | diff --git a/conda_pack/tests/test_core.py b/conda_pack/tests/test_core.py
index 7c9cd80..02839a3 100644
--- a/conda_pack/tests/test_core.py
+++ b/conda_pack/tests/test_core.py
@@ -2,6 +2,7 @@ from __future__ import absolute_import, print_function, division
import json
import os
+import re
import subprocess
import tarfile
from glob import glob
@@ -10,6 +11,7 @@ import pytest
from conda_pack import CondaEnv, CondaPackException, pack
from conda_pack.core import name_to_prefix, File
+from conda_pack.compat import load_source
from .conftest import (py36_path, py36_editable_path, py36_broken_path,
py27_path, nopython_path, has_conda_path, rel_env_dir,
@@ -238,6 +240,13 @@ def test_roundtrip(tmpdir, py36_env):
stderr=subprocess.STDOUT).decode()
assert out.startswith('conda-unpack')
+ # Check no prefix generated for python executable
+ python_pattern = re.compile('bin/python\d.\d')
+ conda_unpack_mod = load_source('conda_unpack', conda_unpack)
+ pythons = [r for r in conda_unpack_mod._prefix_records
+ if python_pattern.match(r[0])]
+ assert not pythons
+
# Check bash scripts all don't error
command = (". {path}/bin/activate && "
"conda-unpack && "
| conda-unpack failed
Steps to reproduce on the new machine:
```
$ mkdir antlr37
$ tar xzf antlr37.tar.gz -C antlr37
$ source antlr37/bin/activate
(antlr37) $ conda-unpack
Traceback (most recent call last):
File "/users/certik/scratch1/pack/antlr37/bin/conda-unpack", line 408, in <module>
placeholder, mode=mode)
File "/users/certik/scratch1/pack/antlr37/bin/conda-unpack", line 66, in update_prefix
with open(path, 'rb+') as fh:
OSError: [Errno 26] Text file busy: '/users/certik/scratch1/pack/antlr37/bin/python3.7'
```
I used the latest `conda-pack` available on conda forge.
I didn't install Python nor conda on the target machine. | 0.0 | f15da7b41c6c4a813fb9dae7797516aca69235fe | [
"conda_pack/tests/test_core.py::test_name_to_prefix",
"conda_pack/tests/test_core.py::test_file"
]
| []
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2018-09-26 17:50:59+00:00 | bsd-3-clause | 1,672 |
|
construct__construct-1040 | diff --git a/construct/expr.py b/construct/expr.py
index 00a63f2..c1dd179 100644
--- a/construct/expr.py
+++ b/construct/expr.py
@@ -14,8 +14,8 @@ opnames = {
operator.xor : "^",
operator.lshift : "<<",
operator.rshift : ">>",
- operator.and_ : "and",
- operator.or_ : "or",
+ operator.and_ : "&",
+ operator.or_ : "|",
operator.not_ : "not",
operator.neg : "-",
operator.pos : "+",
| construct/construct | c2819dc93507c5467d134ed2b58fc2dd895c96d8 | diff --git a/tests/test_core.py b/tests/test_core.py
index 1876796..e92426c 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -2398,3 +2398,13 @@ def test_nullterminated_longterm_issue_1046():
d = NullTerminated(GreedyBytes, term=b"END")
assert d.parse(b"xxxEND") == b"xxx"
raises(d.parse, b"xENDxx") == StreamError
+
+def test_compile_binexpr_bitwise_and_issue_1039():
+ d = Struct(
+ "a" / Int8ub,
+ "cond" / If(this.a & 32, Int8ub),
+ Terminated,
+ )
+ common(d, b"\x00", {"a": 0, "cond": None})
+ common(d, b"\x01", {"a": 1, "cond": None})
+ common(d, b" \x05", {"a": 32, "cond": 5})
| Bitwise And is compiled as logical And
`ExprMixin` for bitwise has different behavior when compiled.
The following test is sufficient to catch the problem
```python
def test_compile_binexpr_bitwise_and():
d = Struct(
"a" / Int8ub,
"cond" / If(this.a & 32, Int8ub),
Terminated,
)
common(d, b"\x00", {"a": 0, "cond": None})
common(d, b"\x01", {"a": 1, "cond": None})
common(d, b" \x05", {"a": 32, "cond": 5})
``` | 0.0 | c2819dc93507c5467d134ed2b58fc2dd895c96d8 | [
"tests/test_core.py::test_compile_binexpr_bitwise_and_issue_1039"
]
| [
"tests/test_core.py::test_bytes",
"tests/test_core.py::test_greedybytes",
"tests/test_core.py::test_bytes_issue_827",
"tests/test_core.py::test_bitwise",
"tests/test_core.py::test_bytewise",
"tests/test_core.py::test_ints",
"tests/test_core.py::test_ints24",
"tests/test_core.py::test_floats",
"tests/test_core.py::test_formatfield",
"tests/test_core.py::test_formatfield_ints_randomized",
"tests/test_core.py::test_formatfield_floats_randomized",
"tests/test_core.py::test_formatfield_bool_issue_901",
"tests/test_core.py::test_bytesinteger",
"tests/test_core.py::test_bitsinteger",
"tests/test_core.py::test_varint",
"tests/test_core.py::test_varint_issue_705",
"tests/test_core.py::test_zigzag",
"tests/test_core.py::test_zigzag_regression",
"tests/test_core.py::test_paddedstring",
"tests/test_core.py::test_pascalstring",
"tests/test_core.py::test_pascalstring_issue_960",
"tests/test_core.py::test_cstring",
"tests/test_core.py::test_greedystring",
"tests/test_core.py::test_string_encodings",
"tests/test_core.py::test_flag",
"tests/test_core.py::test_enum",
"tests/test_core.py::test_enum_enum34",
"tests/test_core.py::test_enum_enum36",
"tests/test_core.py::test_enum_issue_298",
"tests/test_core.py::test_enum_issue_677",
"tests/test_core.py::test_flagsenum",
"tests/test_core.py::test_flagsenum_enum34",
"tests/test_core.py::test_flagsenum_enum36",
"tests/test_core.py::test_mapping",
"tests/test_core.py::test_struct",
"tests/test_core.py::test_struct_nested",
"tests/test_core.py::test_struct_kwctor",
"tests/test_core.py::test_struct_proper_context",
"tests/test_core.py::test_struct_sizeof_context_nesting",
"tests/test_core.py::test_sequence",
"tests/test_core.py::test_sequence_nested",
"tests/test_core.py::test_array",
"tests/test_core.py::test_array_nontellable",
"tests/test_core.py::test_greedyrange",
"tests/test_core.py::test_repeatuntil",
"tests/test_core.py::test_const",
"tests/test_core.py::test_computed",
"tests/test_core.py::test_rebuild",
"tests/test_core.py::test_rebuild_issue_664",
"tests/test_core.py::test_default",
"tests/test_core.py::test_check",
"tests/test_core.py::test_error",
"tests/test_core.py::test_focusedseq",
"tests/test_core.py::test_pickled",
"tests/test_core.py::test_namedtuple",
"tests/test_core.py::test_hex",
"tests/test_core.py::test_hexdump",
"tests/test_core.py::test_hexdump_regression_issue_188",
"tests/test_core.py::test_union",
"tests/test_core.py::test_union_kwctor",
"tests/test_core.py::test_union_issue_348",
"tests/test_core.py::test_select",
"tests/test_core.py::test_select_kwctor",
"tests/test_core.py::test_optional",
"tests/test_core.py::test_optional_in_struct_issue_747",
"tests/test_core.py::test_optional_in_bit_struct_issue_747",
"tests/test_core.py::test_select_buildfromnone_issue_747",
"tests/test_core.py::test_if",
"tests/test_core.py::test_ifthenelse",
"tests/test_core.py::test_switch",
"tests/test_core.py::test_switch_issue_357",
"tests/test_core.py::test_stopif",
"tests/test_core.py::test_padding",
"tests/test_core.py::test_padded",
"tests/test_core.py::test_aligned",
"tests/test_core.py::test_alignedstruct",
"tests/test_core.py::test_bitstruct",
"tests/test_core.py::test_pointer",
"tests/test_core.py::test_peek",
"tests/test_core.py::test_offsettedend",
"tests/test_core.py::test_seek",
"tests/test_core.py::test_tell",
"tests/test_core.py::test_pass",
"tests/test_core.py::test_terminated",
"tests/test_core.py::test_rawcopy",
"tests/test_core.py::test_rawcopy_issue_289",
"tests/test_core.py::test_rawcopy_issue_358",
"tests/test_core.py::test_rawcopy_issue_888",
"tests/test_core.py::test_byteswapped",
"tests/test_core.py::test_byteswapped_from_issue_70",
"tests/test_core.py::test_bitsswapped",
"tests/test_core.py::test_prefixed",
"tests/test_core.py::test_prefixedarray",
"tests/test_core.py::test_fixedsized",
"tests/test_core.py::test_nullterminated",
"tests/test_core.py::test_nullstripped",
"tests/test_core.py::test_restreamdata",
"tests/test_core.py::test_transformed",
"tests/test_core.py::test_transformed_issue_676",
"tests/test_core.py::test_restreamed",
"tests/test_core.py::test_restreamed_partial_read",
"tests/test_core.py::test_processxor",
"tests/test_core.py::test_processrotateleft",
"tests/test_core.py::test_checksum",
"tests/test_core.py::test_checksum_nonbytes_issue_323",
"tests/test_core.py::test_compressed_zlib",
"tests/test_core.py::test_compressed_gzip",
"tests/test_core.py::test_compressed_bzip2",
"tests/test_core.py::test_compressed_lzma",
"tests/test_core.py::test_compressed_prefixed",
"tests/test_core.py::test_rebuffered",
"tests/test_core.py::test_lazy",
"tests/test_core.py::test_lazy_issue_938",
"tests/test_core.py::test_lazy_seek",
"tests/test_core.py::test_lazystruct",
"tests/test_core.py::test_lazyarray",
"tests/test_core.py::test_lazybound",
"tests/test_core.py::test_expradapter",
"tests/test_core.py::test_exprsymmetricadapter",
"tests/test_core.py::test_exprvalidator",
"tests/test_core.py::test_ipaddress_adapter_issue_95",
"tests/test_core.py::test_oneof",
"tests/test_core.py::test_noneof",
"tests/test_core.py::test_filter",
"tests/test_core.py::test_slicing",
"tests/test_core.py::test_indexing",
"tests/test_core.py::test_probe",
"tests/test_core.py::test_debugger",
"tests/test_core.py::test_repr",
"tests/test_core.py::test_operators",
"tests/test_core.py::test_operators_issue_87",
"tests/test_core.py::test_from_issue_76",
"tests/test_core.py::test_from_issue_60",
"tests/test_core.py::test_from_issue_171",
"tests/test_core.py::test_from_issue_175",
"tests/test_core.py::test_from_issue_71",
"tests/test_core.py::test_from_issue_231",
"tests/test_core.py::test_from_issue_246",
"tests/test_core.py::test_from_issue_244",
"tests/test_core.py::test_from_issue_269",
"tests/test_core.py::test_hanging_issue_280",
"tests/test_core.py::test_from_issue_324",
"tests/test_core.py::test_from_issue_357",
"tests/test_core.py::test_context_is_container",
"tests/test_core.py::test_from_issue_362",
"tests/test_core.py::test_this_expresion_compare_container",
"tests/test_core.py::test_exposing_members_attributes",
"tests/test_core.py::test_exposing_members_context",
"tests/test_core.py::test_isparsingbuilding",
"tests/test_core.py::test_struct_stream",
"tests/test_core.py::test_struct_root_topmost",
"tests/test_core.py::test_parsedhook_repeatersdiscard",
"tests/test_core.py::test_greedyrange_issue_697",
"tests/test_core.py::test_greedybytes_issue_697",
"tests/test_core.py::test_hex_issue_709",
"tests/test_core.py::test_buildfile_issue_737",
"tests/test_core.py::test_struct_copy",
"tests/test_core.py::test_switch_issue_913_using_enum",
"tests/test_core.py::test_switch_issue_913_using_strings",
"tests/test_core.py::test_switch_issue_913_using_integers",
"tests/test_core.py::test_nullterminated_longterm_issue_1046"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2023-08-01 16:26:20+00:00 | mit | 1,673 |
|
construct__construct-277 | diff --git a/construct/expr.py b/construct/expr.py
index f20c6a0..765986a 100644
--- a/construct/expr.py
+++ b/construct/expr.py
@@ -146,6 +146,8 @@ class Path(ExprMixin):
return context2[self.__name]
def __getattr__(self, name):
return Path(name, self)
+ def __getitem__(self, name):
+ return Path(name, self)
this = Path("this")
diff --git a/docs/meta.rst b/docs/meta.rst
index fe0b125..c71afa6 100644
--- a/docs/meta.rst
+++ b/docs/meta.rst
@@ -62,13 +62,15 @@ Container(length1=49)(inner=Container(length2=50)(sum=99))
Using `this` expression
===========================
-Certain classes take a number of elements, or something similar, and allow a callable to be provided instead. This callable is called at parsing and building, and is provided the current context object. Context is always a Container, not a dict, so it supports attribute as well as key access. Amazingly, this can get even more fancy. Tomer Filiba provided even a better syntax. The `this` singleton object can be used to build a lambda expression. All three examples below are equivalent:
+Certain classes take a number of elements, or something similar, and allow a callable to be provided instead. This callable is called at parsing and building, and is provided the current context object. Context is always a Container, not a dict, so it supports attribute as well as key access. Amazingly, this can get even more fancy. Tomer Filiba provided even a better syntax. The `this` singleton object can be used to build a lambda expression. All four examples below are equivalent:
>>> lambda ctx: ctx["_"]["field"]
...
>>> lambda ctx: ctx._.field
...
>>> this._.field
+...
+>>> this["_"]["field"]
Of course, `this` can be mixed with other calculations. When evaluating, each instance of this is replaced by ctx.
| construct/construct | 93fee38c2f17a10cdd35aa5db13ec1eb4a4bb517 | diff --git a/tests/test_this.py b/tests/test_this.py
index 4bea240..156583a 100644
--- a/tests/test_this.py
+++ b/tests/test_this.py
@@ -31,6 +31,14 @@ class TestThis(unittest.TestCase):
assert this_example.parse(b"\x05helloABXXXX") == Container(length=5)(value=b'hello')(nested=Container(b1=65)(b2=66)(b3=4295))(condition=1482184792)
assert this_example.build(dict(length=5, value=b'hello', nested=dict(b1=65, b2=66), condition=1482184792)) == b"\x05helloABXXXX"
+ def test_this_getitem(self):
+ gi = Struct(
+ "length of text" / Int8ub,
+ "text" / Bytes(this["length of text"]),
+ )
+ assert gi.parse(b"\x06World!") == Container({"length of text": 6, "text":b"World!"})
+ assert gi.build({"length of text": 6, "text":b"World!"}) == b"\x06World!"
+
def test_path(self):
path = Path("path")
x = ~((path.foo * 2 + 3 << 2) % 11)
| Support indexing on this.
Simply adding a `__getitem__` to the Path, we then have the this expression to work with `[]`
This addition allows the following expression to work.
`this['flag with spaces'] == 0`
```
diff --git a/construct/expr.py b/construct/expr.py
index f20c6a0..5a5371e 100644
--- a/construct/expr.py
+++ b/construct/expr.py
@@ -146,6 +146,8 @@ class Path(ExprMixin):
return context2[self.__name]
def __getattr__(self, name):
return Path(name, self)
+ def __getitem__(self, name):
+ return Path(name, self)
``` | 0.0 | 93fee38c2f17a10cdd35aa5db13ec1eb4a4bb517 | [
"tests/test_this.py::TestThis::test_this_getitem"
]
| [
"tests/test_this.py::TestThis::test_functions",
"tests/test_this.py::TestThis::test_obj",
"tests/test_this.py::TestThis::test_path",
"tests/test_this.py::TestThis::test_singletons",
"tests/test_this.py::TestThis::test_this"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2016-11-24 23:13:11+00:00 | mit | 1,674 |
|
construct__construct-363 | diff --git a/construct/core.py b/construct/core.py
index ec37366..976384f 100644
--- a/construct/core.py
+++ b/construct/core.py
@@ -64,26 +64,26 @@ def singleton(cls):
def singletonfunction(func):
return func()
-def _read_stream(stream, length):
+def _read_stream(stream, length, unitname="bytes"):
# if not isinstance(length, int):
# raise TypeError("expected length to be int")
if length < 0:
raise ValueError("length must be >= 0", length)
data = stream.read(length)
if len(data) != length:
- raise FieldError("could not read enough bytes, expected %d, found %d" % (length, len(data)))
+ raise FieldError("could not read enough %s, expected %d, found %d" % (unitname, length, len(data)))
return data
-def _write_stream(stream, length, data):
+def _write_stream(stream, length, data, unitname="bytes"):
# if not isinstance(data, bytes):
# raise TypeError("expected data to be a bytes")
if length < 0:
raise ValueError("length must be >= 0", length)
if len(data) != length:
- raise FieldError("could not write bytes, expected %d, found %d" % (length, len(data)))
+ raise FieldError("could not write %s, expected %d, found %d" % (unitname, length, len(data)))
written = stream.write(data)
if written is not None and written != length:
- raise FieldError("could not write bytes, written %d, should %d" % (written, length))
+ raise FieldError("could not write %s, written %d, should %d" % (unitname, written, length))
#===============================================================================
@@ -481,7 +481,7 @@ def Bitwise(subcon):
>>> Bitwise(Octet).sizeof()
1
"""
- return Restreamed(subcon, bits2bytes, 8, bytes2bits, 1, lambda n: n//8)
+ return Restreamed(subcon, bits2bytes, 8, bytes2bits, 1, "bits", lambda n: n//8)
def Bytewise(subcon):
@@ -499,7 +499,7 @@ def Bytewise(subcon):
>>> Bitwise(Bytewise(Byte)).sizeof()
1
"""
- return Restreamed(subcon, bytes2bits, 1, bits2bytes, 8, lambda n: n*8)
+ return Restreamed(subcon, bytes2bits, 1, bits2bytes, 8, "bytes", lambda n: n*8)
class BytesInteger(Construct):
@@ -577,7 +577,7 @@ class BitsInteger(Construct):
self.bytesize = bytesize
def _parse(self, stream, context, path):
length = self.length(context) if callable(self.length) else self.length
- data = _read_stream(stream, length)
+ data = _read_stream(stream, length, "bits")
if self.swapped:
data = swapbytes(data, self.bytesize)
return bits2integer(data, self.signed)
@@ -1767,6 +1767,7 @@ class Restreamed(Subconstruct):
:param encoderunit: ratio as int, encoder takes that many bytes at once
:param decoder: a function that takes a b-string and returns a b-string (used when parsing)
:param decoderunit: ratio as int, decoder takes that many bytes at once
+ :param decoderunitname: English string that describes the units (plural) returned by the decoder. Used for error messages.
:param sizecomputer: a function that computes amount of bytes outputed by some bytes
Example::
@@ -1774,21 +1775,23 @@ class Restreamed(Subconstruct):
Bitwise <--> Restreamed(subcon, bits2bytes, 8, bytes2bits, 1, lambda n: n//8)
Bytewise <--> Restreamed(subcon, bytes2bits, 1, bits2bytes, 8, lambda n: n*8)
"""
- __slots__ = ["sizecomputer", "encoder", "encoderunit", "decoder", "decoderunit"]
- def __init__(self, subcon, encoder, encoderunit, decoder, decoderunit, sizecomputer):
+
+ __slots__ = ["sizecomputer", "encoder", "encoderunit", "decoder", "decoderunit", "decoderunitname"]
+ def __init__(self, subcon, encoder, encoderunit, decoder, decoderunit, decoderunitname, sizecomputer):
super(Restreamed, self).__init__(subcon)
self.encoder = encoder
self.encoderunit = encoderunit
self.decoder = decoder
self.decoderunit = decoderunit
+ self.decoderunitname = decoderunitname
self.sizecomputer = sizecomputer
def _parse(self, stream, context, path):
- stream2 = RestreamedBytesIO(stream, self.encoder, self.encoderunit, self.decoder, self.decoderunit)
+ stream2 = RestreamedBytesIO(stream, self.encoder, self.encoderunit, self.decoder, self.decoderunit, self.decoderunitname)
obj = self.subcon._parse(stream2, context, path)
stream2.close()
return obj
def _build(self, obj, stream, context, path):
- stream2 = RestreamedBytesIO(stream, self.encoder, self.encoderunit, self.decoder, self.decoderunit)
+ stream2 = RestreamedBytesIO(stream, self.encoder, self.encoderunit, self.decoder, self.decoderunit, self.decoderunitname)
buildret = self.subcon._build(obj, stream2, context, path)
stream2.close()
return buildret
@@ -2163,6 +2166,7 @@ def ByteSwapped(subcon):
return Restreamed(subcon,
lambda s: s[::-1], subcon.sizeof(),
lambda s: s[::-1], subcon.sizeof(),
+ "bytes",
lambda n: n)
@@ -2182,6 +2186,7 @@ def BitsSwapped(subcon):
return Restreamed(subcon,
lambda s: bits2bytes(bytes2bits(s)[::-1]), 1,
lambda s: bits2bytes(bytes2bits(s)[::-1]), 1,
+ "bits",
lambda n: n)
diff --git a/construct/lib/bitstream.py b/construct/lib/bitstream.py
index 76c34ca..5425c05 100644
--- a/construct/lib/bitstream.py
+++ b/construct/lib/bitstream.py
@@ -5,14 +5,15 @@ from sys import maxsize
class RestreamedBytesIO(object):
- __slots__ = ["substream", "encoder", "encoderunit", "decoder", "decoderunit", "rbuffer", "wbuffer","sincereadwritten"]
+ __slots__ = ["substream", "encoder", "encoderunit", "decoder", "decoderunit", "decoderunitname", "rbuffer", "wbuffer","sincereadwritten"]
- def __init__(self, substream, encoder, encoderunit, decoder, decoderunit):
+ def __init__(self, substream, encoder, encoderunit, decoder, decoderunit, decoderunitname):
self.substream = substream
self.encoder = encoder
self.encoderunit = encoderunit
self.decoder = decoder
self.decoderunit = decoderunit
+ self.decoderunitname = decoderunitname
self.rbuffer = b""
self.wbuffer = b""
self.sincereadwritten = 0
@@ -23,7 +24,7 @@ class RestreamedBytesIO(object):
while len(self.rbuffer) < count:
data = self.substream.read(self.decoderunit)
if data is None or len(data) == 0:
- raise IOError("Restreamed cannot satisfy read request of %d bytes" % count)
+ raise IOError("Restreamed cannot satisfy read request of %d %s" % (count, self.decoderunitname))
self.rbuffer += self.decoder(data)
data, self.rbuffer = self.rbuffer[:count], self.rbuffer[count:]
self.sincereadwritten += count
@@ -40,9 +41,9 @@ class RestreamedBytesIO(object):
def close(self):
if len(self.rbuffer):
- raise ValueError("closing stream but %d unread bytes remain, %d is decoded unit" % (len(self.rbuffer), self.decoderunit))
+ raise ValueError("closing stream but %d unread %s remain, %d is decoded unit" % (len(self.rbuffer), self.decoderunitname, self.decoderunit))
if len(self.wbuffer):
- raise ValueError("closing stream but %d unwritten bytes remain, %d is encoded unit" % (len(self.wbuffer), self.encoderunit))
+ raise ValueError("closing stream but %d unwritten %s remain, %d is encoded unit" % (len(self.wbuffer), self.decoderunitname, self.encoderunit))
def seekable(self):
return False
| construct/construct | a8a3645789c832a8ea6260728f81d36dddf899c4 | diff --git a/tests/test_all.py b/tests/test_all.py
index 04eed61..ad0997d 100644
--- a/tests/test_all.py
+++ b/tests/test_all.py
@@ -1084,13 +1084,13 @@ class TestCore(unittest.TestCase):
Struct(ProbeInto(this.inner)).build({})
def test_restreamed(self):
- assert Restreamed(Int16ub, ident, 1, ident, 1, ident).parse(b"\x00\x01") == 1
- assert Restreamed(Int16ub, ident, 1, ident, 1, ident).build(1) == b"\x00\x01"
- assert Restreamed(Int16ub, ident, 1, ident, 1, ident).sizeof() == 2
- assert raises(Restreamed(VarInt, ident, 1, ident, 1, ident).sizeof) == SizeofError
- assert Restreamed(Bytes(2), None, None, lambda b: b*2, 1, None).parse(b"a") == b"aa"
- assert Restreamed(Bytes(1), lambda b: b*2, 1, None, None, None).build(b"a") == b"aa"
- assert Restreamed(Bytes(5), None, None, None, None, lambda n: n*2).sizeof() == 10
+ assert Restreamed(Int16ub, ident, 1, ident, 1, "bytes", ident).parse(b"\x00\x01") == 1
+ assert Restreamed(Int16ub, ident, 1, ident, 1, "bytes", ident).build(1) == b"\x00\x01"
+ assert Restreamed(Int16ub, ident, 1, ident, 1, "bytes", ident).sizeof() == 2
+ assert raises(Restreamed(VarInt, ident, 1, ident, 1, "bytes", ident).sizeof) == SizeofError
+ assert Restreamed(Bytes(2), None, None, lambda b: b*2, 1, "bytes", None).parse(b"a") == b"aa"
+ assert Restreamed(Bytes(1), lambda b: b*2, 1, None, None, "bytes", None).build(b"a") == b"aa"
+ assert Restreamed(Bytes(5), None, None, None, None, "bytes", lambda n: n*2).sizeof() == 10
def test_rebuffered(self):
data = b"0" * 1000
| Error message says 'bytes', not bits when there aren't enough bits for BitsInteger
If you try to read `x` more bits than are available using a BitsInteger, the error message incorrectly states that you are trying to request `x` extra bytes, not bits.
Example code:
```python
from construct import BitStruct, Bit, BitsInteger
MY_MESSAGE = BitStruct(
Bit[7],
BitsInteger(17)
)
MY_MESSAGE.parse(b'A')
```
```
Traceback (most recent call last):
File "test.py", line 8, in <module>
MY_MESSAGE.parse(b'A')
File "env\lib\site-packages\construct\core.py", line 165, in parse
return self.parse_stream(BytesIO(data), context, **kw)
File "env\lib\site-packages\construct\core.py", line 176, in parse_stream
return self._parse(stream, context, "parsing")
File "env\lib\site-packages\construct\core.py", line 1791, in _parse
obj = self.subcon._parse(self.stream2, context, path)
File "env\lib\site-packages\construct\core.py", line 849, in _parse
subobj = sc._parse(stream, context, path)
File "env\lib\site-packages\construct\core.py", line 576, in _parse
data = _read_stream(stream, length)
File "env\lib\site-packages\construct\core.py", line 72, in _read_stream
data = stream.read(length)
File "env\lib\site-packages\construct\lib\bitstream.py", line 26, in read
raise IOError("Restreamed cannot satisfy read request of %d bytes" % count)
OSError: Restreamed cannot satisfy read request of 17 bytes
```
While trying to parse a complicated object, I was confused as to what combination of my bit fields added to the number of bytes presented in the error message.
In the above example, it should report `OSError: Restreamed cannot satisfy read request of 17 bits` | 0.0 | a8a3645789c832a8ea6260728f81d36dddf899c4 | [
"tests/test_all.py::TestCore::test_restreamed"
]
| [
"tests/test_all.py::TestCore::test_aligned",
"tests/test_all.py::TestCore::test_alignedstruct",
"tests/test_all.py::TestCore::test_array",
"tests/test_all.py::TestCore::test_bitsinteger",
"tests/test_all.py::TestCore::test_bitsswapped",
"tests/test_all.py::TestCore::test_bitsswapped_from_issue_145",
"tests/test_all.py::TestCore::test_bitstruct",
"tests/test_all.py::TestCore::test_bitstruct_from_issue_39",
"tests/test_all.py::TestCore::test_bitwise",
"tests/test_all.py::TestCore::test_byte",
"tests/test_all.py::TestCore::test_bytes",
"tests/test_all.py::TestCore::test_bytesinteger",
"tests/test_all.py::TestCore::test_byteswapped",
"tests/test_all.py::TestCore::test_byteswapped_from_issue_70",
"tests/test_all.py::TestCore::test_bytewise",
"tests/test_all.py::TestCore::test_check",
"tests/test_all.py::TestCore::test_checksum",
"tests/test_all.py::TestCore::test_compressed_bzip2",
"tests/test_all.py::TestCore::test_compressed_gzip",
"tests/test_all.py::TestCore::test_compressed_lzma",
"tests/test_all.py::TestCore::test_compressed_prefixed",
"tests/test_all.py::TestCore::test_compressed_zlib",
"tests/test_all.py::TestCore::test_computed",
"tests/test_all.py::TestCore::test_const",
"tests/test_all.py::TestCore::test_cstring",
"tests/test_all.py::TestCore::test_default",
"tests/test_all.py::TestCore::test_embeddedbitstruct",
"tests/test_all.py::TestCore::test_embeddedif_issue_296",
"tests/test_all.py::TestCore::test_embeddedswitch_issue_312",
"tests/test_all.py::TestCore::test_enum",
"tests/test_all.py::TestCore::test_error",
"tests/test_all.py::TestCore::test_expradapter",
"tests/test_all.py::TestCore::test_exprsymmetricadapter",
"tests/test_all.py::TestCore::test_exprvalidator",
"tests/test_all.py::TestCore::test_filter",
"tests/test_all.py::TestCore::test_flag",
"tests/test_all.py::TestCore::test_flagsenum",
"tests/test_all.py::TestCore::test_floats",
"tests/test_all.py::TestCore::test_floats_randomized",
"tests/test_all.py::TestCore::test_focusedseq",
"tests/test_all.py::TestCore::test_formatfield",
"tests/test_all.py::TestCore::test_formatfield_floats_randomized",
"tests/test_all.py::TestCore::test_formatfield_ints_randomized",
"tests/test_all.py::TestCore::test_from_issue_171",
"tests/test_all.py::TestCore::test_from_issue_175",
"tests/test_all.py::TestCore::test_from_issue_231",
"tests/test_all.py::TestCore::test_from_issue_244",
"tests/test_all.py::TestCore::test_from_issue_246",
"tests/test_all.py::TestCore::test_from_issue_269",
"tests/test_all.py::TestCore::test_from_issue_28",
"tests/test_all.py::TestCore::test_from_issue_298",
"tests/test_all.py::TestCore::test_from_issue_324",
"tests/test_all.py::TestCore::test_from_issue_357",
"tests/test_all.py::TestCore::test_from_issue_362",
"tests/test_all.py::TestCore::test_from_issue_60",
"tests/test_all.py::TestCore::test_from_issue_71",
"tests/test_all.py::TestCore::test_from_issue_76",
"tests/test_all.py::TestCore::test_from_issue_87",
"tests/test_all.py::TestCore::test_globally_encoded_strings",
"tests/test_all.py::TestCore::test_greedybytes",
"tests/test_all.py::TestCore::test_greedyrange",
"tests/test_all.py::TestCore::test_greedystring",
"tests/test_all.py::TestCore::test_hanging_issue_280",
"tests/test_all.py::TestCore::test_hex",
"tests/test_all.py::TestCore::test_hex_regression_188",
"tests/test_all.py::TestCore::test_hexdump",
"tests/test_all.py::TestCore::test_hexdump_regression_188",
"tests/test_all.py::TestCore::test_if",
"tests/test_all.py::TestCore::test_ifthenelse",
"tests/test_all.py::TestCore::test_indexing",
"tests/test_all.py::TestCore::test_ints",
"tests/test_all.py::TestCore::test_ints24",
"tests/test_all.py::TestCore::test_ipaddress_from_issue_95",
"tests/test_all.py::TestCore::test_lazybound",
"tests/test_all.py::TestCore::test_lazybound_node",
"tests/test_all.py::TestCore::test_lazyrange",
"tests/test_all.py::TestCore::test_lazysequence",
"tests/test_all.py::TestCore::test_lazysequence_nested_embedded",
"tests/test_all.py::TestCore::test_lazystruct",
"tests/test_all.py::TestCore::test_lazystruct_nested_embedded",
"tests/test_all.py::TestCore::test_namedtuple",
"tests/test_all.py::TestCore::test_nonbytes_checksum_issue_323",
"tests/test_all.py::TestCore::test_noneof",
"tests/test_all.py::TestCore::test_ondemand",
"tests/test_all.py::TestCore::test_ondemandpointer",
"tests/test_all.py::TestCore::test_oneof",
"tests/test_all.py::TestCore::test_operators",
"tests/test_all.py::TestCore::test_optional",
"tests/test_all.py::TestCore::test_padded",
"tests/test_all.py::TestCore::test_padding",
"tests/test_all.py::TestCore::test_pascalstring",
"tests/test_all.py::TestCore::test_pass",
"tests/test_all.py::TestCore::test_peek",
"tests/test_all.py::TestCore::test_pointer",
"tests/test_all.py::TestCore::test_prefixed",
"tests/test_all.py::TestCore::test_prefixedarray",
"tests/test_all.py::TestCore::test_probe",
"tests/test_all.py::TestCore::test_probeinto",
"tests/test_all.py::TestCore::test_range",
"tests/test_all.py::TestCore::test_rawcopy",
"tests/test_all.py::TestCore::test_rawcopy_issue_289",
"tests/test_all.py::TestCore::test_rawcopy_issue_358",
"tests/test_all.py::TestCore::test_rebuffered",
"tests/test_all.py::TestCore::test_rebuild",
"tests/test_all.py::TestCore::test_renamed",
"tests/test_all.py::TestCore::test_repeatuntil",
"tests/test_all.py::TestCore::test_seek",
"tests/test_all.py::TestCore::test_select",
"tests/test_all.py::TestCore::test_select_kwctor",
"tests/test_all.py::TestCore::test_sequence",
"tests/test_all.py::TestCore::test_sequence_nested_embedded",
"tests/test_all.py::TestCore::test_slicing",
"tests/test_all.py::TestCore::test_stopif",
"tests/test_all.py::TestCore::test_string",
"tests/test_all.py::TestCore::test_struct",
"tests/test_all.py::TestCore::test_struct_kwctor",
"tests/test_all.py::TestCore::test_struct_nested_embedded",
"tests/test_all.py::TestCore::test_struct_proper_context",
"tests/test_all.py::TestCore::test_struct_sizeof_context_nesting",
"tests/test_all.py::TestCore::test_switch",
"tests/test_all.py::TestCore::test_tell",
"tests/test_all.py::TestCore::test_terminated",
"tests/test_all.py::TestCore::test_union",
"tests/test_all.py::TestCore::test_union_issue_348",
"tests/test_all.py::TestCore::test_union_kwctor",
"tests/test_all.py::TestCore::test_varint",
"tests/test_all.py::TestCore::test_varint_randomized"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2017-06-06 10:40:15+00:00 | mit | 1,675 |
|
construct__construct-399 | diff --git a/construct/core.py b/construct/core.py
index 85406a7..9b3bbc4 100644
--- a/construct/core.py
+++ b/construct/core.py
@@ -1126,17 +1126,12 @@ class RepeatUntil(Subconstruct):
super(RepeatUntil, self).__init__(subcon)
self.predicate = predicate
def _parse(self, stream, context, path):
- try:
- obj = []
- while True:
- subobj = self.subcon._parse(stream, context, path)
- obj.append(subobj)
- if self.predicate(subobj, obj, context):
- return ListContainer(obj)
- except ExplicitError:
- raise
- except ConstructError:
- raise RangeError("missing terminator when parsing")
+ obj = []
+ while True:
+ subobj = self.subcon._parse(stream, context, path)
+ obj.append(subobj)
+ if self.predicate(subobj, obj, context):
+ return ListContainer(obj)
def _build(self, obj, stream, context, path):
for i, subobj in enumerate(obj):
self.subcon._build(subobj, stream, context, path)
| construct/construct | 670eb6c1b6e9f6c9e6ea7102d08d115612818134 | diff --git a/tests/test_all.py b/tests/test_all.py
index 7681026..d9ef53e 100644
--- a/tests/test_all.py
+++ b/tests/test_all.py
@@ -252,7 +252,7 @@ class TestCore(unittest.TestCase):
def test_repeatuntil(self):
assert RepeatUntil(obj_ == 9, Byte).parse(b"\x02\x03\x09garbage") == [2,3,9]
assert RepeatUntil(obj_ == 9, Byte).build([2,3,9,1,1,1]) == b"\x02\x03\x09"
- assert raises(RepeatUntil(obj_ == 9, Byte).parse, b"\x02\x03\x08") == RangeError
+ assert raises(RepeatUntil(obj_ == 9, Byte).parse, b"\x02\x03\x08") == FieldError
assert raises(RepeatUntil(obj_ == 9, Byte).build, [2,3,8]) == RangeError
assert raises(RepeatUntil(obj_ == 9, Byte).sizeof) == SizeofError
assert RepeatUntil(lambda x,lst,ctx: lst[-2:]==[0,0], Byte).parse(b"\x01\x00\x00\xff") == [1,0,0]
| RepeatUntil catches too broad of Exception, gives misleading message
The following code:
```python
from construct import RepeatUntil, Const, Struct, Int32ul
data = b"\x01\x00\x00\x00" * 10
TEN_ONES = Struct(
RepeatUntil(lambda obj, lst, ctx: len(lst) == 10, Const(Int32ul, 1))
)
TEN_TWOS = Struct(
RepeatUntil(lambda obj, lst, ctx: len(lst) == 10, Const(Int32ul, 2))
)
TEN_ONES.parse(data) # Works
TEN_TWOS.parse(data) # Opaque/Misleading Exception
```
Gives the error message:
```
$> env/bin/python test_construct.py
Traceback (most recent call last):
File "test_construct.py", line 16, in <module>
TEN_TWOS.parse(data)
File "env/lib/python2.7/site-packages/construct/core.py", line 161, in parse
return self.parse_stream(BytesIO(data), context, **kw)
File "env/lib/python2.7/site-packages/construct/core.py", line 174, in parse_stream
return self._parse(stream, context2, "(parsing)")
File "env/lib/python2.7/site-packages/construct/core.py", line 844, in _parse
subobj = sc._parse(stream, context, path)
File "env/lib/python2.7/site-packages/construct/core.py", line 1140, in _parse
raise RangeError("missing terminator when parsing")
construct.core.RangeError: missing terminator when parsing
```
But this not what I expected. For instance, with the following code:
```python
from construct import Const, Struct, Int32ul
data = b"\x01\x00\x00\x00"
ONE = Struct(
Const(Int32ul, 1)
)
TWO = Struct(
Const(Int32ul, 2)
)
ONE.parse(data) # Works
TWO.parse(data) # Expected Exception given
```
Gives the error message:
```
$> env/bin/python test_construct2.py
Traceback (most recent call last):
File "test_construct2.py", line 15, in <module>
TWO.parse(data) # Expected Exception given
File "env/lib/python2.7/site-packages/construct/core.py", line 161, in parse
return self.parse_stream(BytesIO(data), context, **kw)
File "env/lib/python2.7/site-packages/construct/core.py", line 174, in parse_stream
return self._parse(stream, context2, "(parsing)")
File "env/lib/python2.7/site-packages/construct/core.py", line 844, in _parse
subobj = sc._parse(stream, context, path)
File "env/lib/python2.7/site-packages/construct/core.py", line 1883, in _parse
raise ConstError("expected %r but parsed %r" % (self.value, obj))
construct.core.ConstError: expected 2 but parsed 1
```
Which is the error message I would have expected from the first example.
In fact, changing [this line](https://github.com/construct/construct/blob/670eb6c1b6e9f6c9e6ea7102d08d115612818134/construct/core.py#L1139) to `raise` gives the expected Exception.
The `RepeatUntil` implementation is catching too broad of Exceptions, and returning misleading error messages as a result. | 0.0 | 670eb6c1b6e9f6c9e6ea7102d08d115612818134 | [
"tests/test_all.py::TestCore::test_repeatuntil"
]
| [
"tests/test_all.py::TestCore::test_aligned",
"tests/test_all.py::TestCore::test_alignedstruct",
"tests/test_all.py::TestCore::test_array",
"tests/test_all.py::TestCore::test_bitsinteger",
"tests/test_all.py::TestCore::test_bitsswapped",
"tests/test_all.py::TestCore::test_bitsswapped_from_issue_145",
"tests/test_all.py::TestCore::test_bitstruct",
"tests/test_all.py::TestCore::test_bitstruct_from_issue_39",
"tests/test_all.py::TestCore::test_bitwise",
"tests/test_all.py::TestCore::test_bytes",
"tests/test_all.py::TestCore::test_bytesinteger",
"tests/test_all.py::TestCore::test_byteswapped",
"tests/test_all.py::TestCore::test_byteswapped_from_issue_70",
"tests/test_all.py::TestCore::test_bytewise",
"tests/test_all.py::TestCore::test_check",
"tests/test_all.py::TestCore::test_checksum",
"tests/test_all.py::TestCore::test_compressed_bzip2",
"tests/test_all.py::TestCore::test_compressed_gzip",
"tests/test_all.py::TestCore::test_compressed_lzma",
"tests/test_all.py::TestCore::test_compressed_prefixed",
"tests/test_all.py::TestCore::test_compressed_zlib",
"tests/test_all.py::TestCore::test_computed",
"tests/test_all.py::TestCore::test_const",
"tests/test_all.py::TestCore::test_context",
"tests/test_all.py::TestCore::test_cstring",
"tests/test_all.py::TestCore::test_default",
"tests/test_all.py::TestCore::test_embeddedbitstruct",
"tests/test_all.py::TestCore::test_embeddedif_issue_296",
"tests/test_all.py::TestCore::test_embeddedswitch_issue_312",
"tests/test_all.py::TestCore::test_enum",
"tests/test_all.py::TestCore::test_error",
"tests/test_all.py::TestCore::test_expradapter",
"tests/test_all.py::TestCore::test_exprsymmetricadapter",
"tests/test_all.py::TestCore::test_exprvalidator",
"tests/test_all.py::TestCore::test_filter",
"tests/test_all.py::TestCore::test_flag",
"tests/test_all.py::TestCore::test_flagsenum",
"tests/test_all.py::TestCore::test_floats",
"tests/test_all.py::TestCore::test_floats_randomized",
"tests/test_all.py::TestCore::test_focusedseq",
"tests/test_all.py::TestCore::test_formatfield",
"tests/test_all.py::TestCore::test_formatfield_floats_randomized",
"tests/test_all.py::TestCore::test_formatfield_ints_randomized",
"tests/test_all.py::TestCore::test_from_issue_171",
"tests/test_all.py::TestCore::test_from_issue_175",
"tests/test_all.py::TestCore::test_from_issue_231",
"tests/test_all.py::TestCore::test_from_issue_244",
"tests/test_all.py::TestCore::test_from_issue_246",
"tests/test_all.py::TestCore::test_from_issue_269",
"tests/test_all.py::TestCore::test_from_issue_28",
"tests/test_all.py::TestCore::test_from_issue_298",
"tests/test_all.py::TestCore::test_from_issue_324",
"tests/test_all.py::TestCore::test_from_issue_357",
"tests/test_all.py::TestCore::test_from_issue_362",
"tests/test_all.py::TestCore::test_from_issue_60",
"tests/test_all.py::TestCore::test_from_issue_71",
"tests/test_all.py::TestCore::test_from_issue_76",
"tests/test_all.py::TestCore::test_from_issue_87",
"tests/test_all.py::TestCore::test_globally_encoded_strings",
"tests/test_all.py::TestCore::test_greedybytes",
"tests/test_all.py::TestCore::test_greedyrange",
"tests/test_all.py::TestCore::test_greedystring",
"tests/test_all.py::TestCore::test_hanging_issue_280",
"tests/test_all.py::TestCore::test_hex",
"tests/test_all.py::TestCore::test_hex_regression_188",
"tests/test_all.py::TestCore::test_hexdump",
"tests/test_all.py::TestCore::test_hexdump_regression_188",
"tests/test_all.py::TestCore::test_if",
"tests/test_all.py::TestCore::test_ifthenelse",
"tests/test_all.py::TestCore::test_indexing",
"tests/test_all.py::TestCore::test_ints",
"tests/test_all.py::TestCore::test_ints24",
"tests/test_all.py::TestCore::test_ipaddress_from_issue_95",
"tests/test_all.py::TestCore::test_lazybound",
"tests/test_all.py::TestCore::test_lazybound_node",
"tests/test_all.py::TestCore::test_lazyrange",
"tests/test_all.py::TestCore::test_lazysequence",
"tests/test_all.py::TestCore::test_lazysequence_kwctor",
"tests/test_all.py::TestCore::test_lazysequence_nested_embedded",
"tests/test_all.py::TestCore::test_lazystruct",
"tests/test_all.py::TestCore::test_lazystruct_kwctor",
"tests/test_all.py::TestCore::test_lazystruct_nested_embedded",
"tests/test_all.py::TestCore::test_namedtuple",
"tests/test_all.py::TestCore::test_nonbytes_checksum_issue_323",
"tests/test_all.py::TestCore::test_noneof",
"tests/test_all.py::TestCore::test_ondemand",
"tests/test_all.py::TestCore::test_ondemandpointer",
"tests/test_all.py::TestCore::test_oneof",
"tests/test_all.py::TestCore::test_operators",
"tests/test_all.py::TestCore::test_optional",
"tests/test_all.py::TestCore::test_padded",
"tests/test_all.py::TestCore::test_padding",
"tests/test_all.py::TestCore::test_pascalstring",
"tests/test_all.py::TestCore::test_pass",
"tests/test_all.py::TestCore::test_peek",
"tests/test_all.py::TestCore::test_pointer",
"tests/test_all.py::TestCore::test_prefixed",
"tests/test_all.py::TestCore::test_prefixedarray",
"tests/test_all.py::TestCore::test_probe",
"tests/test_all.py::TestCore::test_probeinto",
"tests/test_all.py::TestCore::test_range",
"tests/test_all.py::TestCore::test_rawcopy",
"tests/test_all.py::TestCore::test_rawcopy_issue_289",
"tests/test_all.py::TestCore::test_rawcopy_issue_358",
"tests/test_all.py::TestCore::test_rebuffered",
"tests/test_all.py::TestCore::test_rebuild",
"tests/test_all.py::TestCore::test_renamed",
"tests/test_all.py::TestCore::test_restreamed",
"tests/test_all.py::TestCore::test_restreamed_partial_read",
"tests/test_all.py::TestCore::test_seek",
"tests/test_all.py::TestCore::test_select",
"tests/test_all.py::TestCore::test_select_kwctor",
"tests/test_all.py::TestCore::test_sequence",
"tests/test_all.py::TestCore::test_sequence_nested_embedded",
"tests/test_all.py::TestCore::test_slicing",
"tests/test_all.py::TestCore::test_stopif",
"tests/test_all.py::TestCore::test_string",
"tests/test_all.py::TestCore::test_struct",
"tests/test_all.py::TestCore::test_struct_kwctor",
"tests/test_all.py::TestCore::test_struct_nested_embedded",
"tests/test_all.py::TestCore::test_struct_proper_context",
"tests/test_all.py::TestCore::test_struct_sizeof_context_nesting",
"tests/test_all.py::TestCore::test_switch",
"tests/test_all.py::TestCore::test_switch_issue_357",
"tests/test_all.py::TestCore::test_tell",
"tests/test_all.py::TestCore::test_terminated",
"tests/test_all.py::TestCore::test_union",
"tests/test_all.py::TestCore::test_union_issue_348",
"tests/test_all.py::TestCore::test_union_kwctor",
"tests/test_all.py::TestCore::test_varint",
"tests/test_all.py::TestCore::test_varint_randomized"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2017-09-12 17:19:41+00:00 | mit | 1,676 |
|
construct__construct-889 | diff --git a/construct/core.py b/construct/core.py
index d2ec15e..785f4a0 100644
--- a/construct/core.py
+++ b/construct/core.py
@@ -351,7 +351,10 @@ class Construct(object):
r"""
Build an object into a closed binary file. See build().
"""
- with open(filename, 'wb') as f:
+ # Open the file for reading as well as writing. This allows builders to
+ # read back the stream just written. For example. RawCopy does this.
+ # See issue #888.
+ with open(filename, 'w+b') as f:
self.build_stream(obj, f, **contextkw)
def _build(self, obj, stream, context, path):
diff --git a/construct/version.py b/construct/version.py
index b2c8dce..513a82f 100644
--- a/construct/version.py
+++ b/construct/version.py
@@ -1,3 +1,3 @@
-version = (2,10,56)
-version_string = "2.10.56"
-release_date = "2020.01.28"
+version = (2,10,57)
+version_string = "2.10.57"
+release_date = "2021.01.26"
| construct/construct | 2626b398a676191114f6ce5d8db903e9590700db | diff --git a/tests/declarativeunittest.py b/tests/declarativeunittest.py
index d02a292..a39fb67 100644
--- a/tests/declarativeunittest.py
+++ b/tests/declarativeunittest.py
@@ -3,7 +3,7 @@ xfail = pytest.mark.xfail
skip = pytest.mark.skip
skipif = pytest.mark.skipif
-import os, math, random, collections, itertools, io, hashlib, binascii
+import os, math, random, collections, itertools, io, hashlib, binascii, tempfile
from construct import *
from construct.lib import *
diff --git a/tests/test_core.py b/tests/test_core.py
index 02e2e64..9da306c 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -930,6 +930,15 @@ def test_rawcopy_issue_358():
d = Struct("a"/RawCopy(Byte), "check"/Check(this.a.value == 255))
assert d.build(dict(a=dict(value=255))) == b"\xff"
+def test_rawcopy_issue_888():
+ # If you use build_file() on a RawCopy that has only a value defined, then
+ # RawCopy._build may also attempt to read from the file, which won't work
+ # if build_file opened the file for writing only.
+ with tempfile.TemporaryDirectory() as tmpdir:
+ fname = os.path.join(tmpdir, 'test')
+ d = RawCopy(Byte)
+ d.build_file(dict(value=0), filename=fname)
+
def test_byteswapped():
d = ByteSwapped(Bytes(5))
common(d, b"12345", b"54321", 5)
| build_file() crashes when using RawCopy with a value only
Thank you for construct!
Here's a failing test case:
def test_rawcopy_build_file_from_value_only(tmpdir):
d = RawCopy(Byte)
d.build_file(dict(value=0), filename=tmpdir.join('test'))
Version: master branch, commit 2626b39.
Expected result: success
Actual result:
construct.core.StreamError: Error in path (building)
stream.read() failed, requested 1 bytes
The cause is that `Construct.build_file()` opens the stream for writing only, but `RawCopy._build()` assumes that the stream is readable when it rewinds the stream to read out what was written to populate the `data` attribute.
Pull request to follow. | 0.0 | 2626b398a676191114f6ce5d8db903e9590700db | [
"tests/test_core.py::test_rawcopy_issue_888"
]
| [
"tests/test_core.py::test_bytes",
"tests/test_core.py::test_greedybytes",
"tests/test_core.py::test_bytes_issue_827",
"tests/test_core.py::test_bitwise",
"tests/test_core.py::test_bytewise",
"tests/test_core.py::test_ints",
"tests/test_core.py::test_ints24",
"tests/test_core.py::test_halffloats",
"tests/test_core.py::test_floats",
"tests/test_core.py::test_formatfield",
"tests/test_core.py::test_formatfield_ints_randomized",
"tests/test_core.py::test_formatfield_floats_randomized",
"tests/test_core.py::test_bytesinteger",
"tests/test_core.py::test_bitsinteger",
"tests/test_core.py::test_varint",
"tests/test_core.py::test_varint_issue_705",
"tests/test_core.py::test_paddedstring",
"tests/test_core.py::test_pascalstring",
"tests/test_core.py::test_cstring",
"tests/test_core.py::test_greedystring",
"tests/test_core.py::test_string_encodings",
"tests/test_core.py::test_flag",
"tests/test_core.py::test_enum",
"tests/test_core.py::test_enum_enum34",
"tests/test_core.py::test_enum_enum36",
"tests/test_core.py::test_enum_issue_298",
"tests/test_core.py::test_enum_issue_677",
"tests/test_core.py::test_flagsenum",
"tests/test_core.py::test_flagsenum_enum34",
"tests/test_core.py::test_flagsenum_enum36",
"tests/test_core.py::test_mapping",
"tests/test_core.py::test_struct",
"tests/test_core.py::test_struct_nested",
"tests/test_core.py::test_struct_kwctor",
"tests/test_core.py::test_struct_proper_context",
"tests/test_core.py::test_struct_sizeof_context_nesting",
"tests/test_core.py::test_sequence",
"tests/test_core.py::test_sequence_nested",
"tests/test_core.py::test_array",
"tests/test_core.py::test_array_nontellable",
"tests/test_core.py::test_greedyrange",
"tests/test_core.py::test_repeatuntil",
"tests/test_core.py::test_const",
"tests/test_core.py::test_computed",
"tests/test_core.py::test_index",
"tests/test_core.py::test_rebuild",
"tests/test_core.py::test_rebuild_issue_664",
"tests/test_core.py::test_default",
"tests/test_core.py::test_check",
"tests/test_core.py::test_error",
"tests/test_core.py::test_focusedseq",
"tests/test_core.py::test_pickled",
"tests/test_core.py::test_namedtuple",
"tests/test_core.py::test_hex",
"tests/test_core.py::test_hexdump",
"tests/test_core.py::test_hexdump_regression_issue_188",
"tests/test_core.py::test_union",
"tests/test_core.py::test_union_kwctor",
"tests/test_core.py::test_union_issue_348",
"tests/test_core.py::test_select",
"tests/test_core.py::test_select_kwctor",
"tests/test_core.py::test_optional",
"tests/test_core.py::test_optional_in_struct_issue_747",
"tests/test_core.py::test_optional_in_bit_struct_issue_747",
"tests/test_core.py::test_select_buildfromnone_issue_747",
"tests/test_core.py::test_if",
"tests/test_core.py::test_ifthenelse",
"tests/test_core.py::test_switch",
"tests/test_core.py::test_switch_issue_357",
"tests/test_core.py::test_stopif",
"tests/test_core.py::test_padding",
"tests/test_core.py::test_padded",
"tests/test_core.py::test_aligned",
"tests/test_core.py::test_alignedstruct",
"tests/test_core.py::test_bitstruct",
"tests/test_core.py::test_pointer",
"tests/test_core.py::test_peek",
"tests/test_core.py::test_seek",
"tests/test_core.py::test_tell",
"tests/test_core.py::test_pass",
"tests/test_core.py::test_terminated",
"tests/test_core.py::test_rawcopy",
"tests/test_core.py::test_rawcopy_issue_289",
"tests/test_core.py::test_rawcopy_issue_358",
"tests/test_core.py::test_byteswapped",
"tests/test_core.py::test_byteswapped_from_issue_70",
"tests/test_core.py::test_bitsswapped",
"tests/test_core.py::test_prefixed",
"tests/test_core.py::test_prefixedarray",
"tests/test_core.py::test_fixedsized",
"tests/test_core.py::test_nullterminated",
"tests/test_core.py::test_nullstripped",
"tests/test_core.py::test_restreamdata",
"tests/test_core.py::test_transformed",
"tests/test_core.py::test_transformed_issue_676",
"tests/test_core.py::test_restreamed",
"tests/test_core.py::test_restreamed_partial_read",
"tests/test_core.py::test_processxor",
"tests/test_core.py::test_processrotateleft",
"tests/test_core.py::test_checksum",
"tests/test_core.py::test_checksum_nonbytes_issue_323",
"tests/test_core.py::test_checksum_warnings_issue_841",
"tests/test_core.py::test_compressed_zlib",
"tests/test_core.py::test_compressed_gzip",
"tests/test_core.py::test_compressed_bzip2",
"tests/test_core.py::test_compressed_lzma",
"tests/test_core.py::test_compressed_prefixed",
"tests/test_core.py::test_rebuffered",
"tests/test_core.py::test_lazy",
"tests/test_core.py::test_lazystruct",
"tests/test_core.py::test_lazyarray",
"tests/test_core.py::test_lazybound",
"tests/test_core.py::test_expradapter",
"tests/test_core.py::test_exprsymmetricadapter",
"tests/test_core.py::test_exprvalidator",
"tests/test_core.py::test_ipaddress_adapter_issue_95",
"tests/test_core.py::test_oneof",
"tests/test_core.py::test_noneof",
"tests/test_core.py::test_filter",
"tests/test_core.py::test_slicing",
"tests/test_core.py::test_indexing",
"tests/test_core.py::test_probe",
"tests/test_core.py::test_debugger",
"tests/test_core.py::test_repr",
"tests/test_core.py::test_operators",
"tests/test_core.py::test_operators_issue_87",
"tests/test_core.py::test_from_issue_76",
"tests/test_core.py::test_from_issue_60",
"tests/test_core.py::test_from_issue_171",
"tests/test_core.py::test_from_issue_175",
"tests/test_core.py::test_from_issue_71",
"tests/test_core.py::test_from_issue_231",
"tests/test_core.py::test_from_issue_246",
"tests/test_core.py::test_from_issue_244",
"tests/test_core.py::test_from_issue_269",
"tests/test_core.py::test_hanging_issue_280",
"tests/test_core.py::test_from_issue_324",
"tests/test_core.py::test_from_issue_357",
"tests/test_core.py::test_context_is_container",
"tests/test_core.py::test_from_issue_362",
"tests/test_core.py::test_this_expresion_compare_container",
"tests/test_core.py::test_exposing_members_attributes",
"tests/test_core.py::test_exposing_members_context",
"tests/test_core.py::test_isparsingbuilding",
"tests/test_core.py::test_struct_stream",
"tests/test_core.py::test_struct_root_topmost",
"tests/test_core.py::test_parsedhook_repeatersdiscard",
"tests/test_core.py::test_greedyrange_issue_697",
"tests/test_core.py::test_greedybytes_issue_697",
"tests/test_core.py::test_hex_issue_709",
"tests/test_core.py::test_buildfile_issue_737"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2020-12-20 21:47:42+00:00 | mit | 1,677 |
|
containers__podman-py-250 | diff --git a/podman/api/__init__.py b/podman/api/__init__.py
index 393f653..b16bc38 100644
--- a/podman/api/__init__.py
+++ b/podman/api/__init__.py
@@ -11,6 +11,7 @@ from podman.api.parse_utils import (
prepare_cidr,
prepare_timestamp,
stream_frames,
+ stream_helper,
)
from podman.api.tar_utils import create_tar, prepare_containerfile, prepare_containerignore
from .. import version
@@ -58,4 +59,5 @@ __all__ = [
'prepare_filters',
'prepare_timestamp',
'stream_frames',
+ 'stream_helper',
]
diff --git a/podman/api/parse_utils.py b/podman/api/parse_utils.py
index ce66bcf..ffd3d8b 100644
--- a/podman/api/parse_utils.py
+++ b/podman/api/parse_utils.py
@@ -97,3 +97,14 @@ def stream_frames(response: Response) -> Iterator[bytes]:
if not data:
return
yield data
+
+
+def stream_helper(
+ response: Response, decode_to_json: bool = False
+) -> Union[Iterator[bytes], Iterator[Dict[str, Any]]]:
+ """Helper to stream results and optionally decode to json"""
+ for value in response.iter_lines():
+ if decode_to_json:
+ yield json.loads(value)
+ else:
+ yield value
diff --git a/podman/domain/containers.py b/podman/domain/containers.py
index 590cd76..8236edf 100644
--- a/podman/domain/containers.py
+++ b/podman/domain/containers.py
@@ -6,7 +6,6 @@ from contextlib import suppress
from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Union
import requests
-from requests import Response
from podman import api
from podman.domain.images import Image
@@ -389,7 +388,9 @@ class Container(PodmanResource):
)
response.raise_for_status()
- def stats(self, **kwargs) -> Iterator[Union[bytes, Dict[str, Any]]]:
+ def stats(
+ self, **kwargs
+ ) -> Union[bytes, Dict[str, Any], Iterator[bytes], Iterator[Dict[str, Any]]]:
"""Return statistics for container.
Keyword Args:
@@ -413,20 +414,9 @@ class Container(PodmanResource):
response.raise_for_status()
if stream:
- return self._stats_helper(decode, response.iter_lines())
+ return api.stream_helper(response, decode_to_json=decode)
- return json.loads(response.text) if decode else response.content
-
- @staticmethod
- def _stats_helper(
- decode: bool, body: Iterator[bytes]
- ) -> Iterator[Union[bytes, Dict[str, Any]]]:
- """Helper needed to allow stats() to return either a generator or a bytes."""
- for entry in body:
- if decode:
- yield json.loads(entry)
- else:
- yield entry
+ return json.loads(response.content) if decode else response.content
def stop(self, **kwargs) -> None:
"""Stop container.
@@ -466,23 +456,20 @@ class Container(PodmanResource):
NotFound: when the container no longer exists
APIError: when the service reports an error
"""
+ stream = kwargs.get("stream", False)
+
params = {
+ "stream": stream,
"ps_args": kwargs.get("ps_args"),
- "stream": kwargs.get("stream", False),
}
- response = self.client.get(f"/containers/{self.id}/top", params=params)
+ response = self.client.get(f"/containers/{self.id}/top", params=params, stream=stream)
response.raise_for_status()
- if params["stream"]:
- self._top_helper(response)
+ if stream:
+ return api.stream_helper(response, decode_to_json=True)
return response.json()
- @staticmethod
- def _top_helper(response: Response) -> Iterator[Dict[str, Any]]:
- for line in response.iter_lines():
- yield line
-
def unpause(self) -> None:
"""Unpause processes in container."""
response = self.client.post(f"/containers/{self.id}/unpause")
| containers/podman-py | 803d2f070f57481b8df234c298cf4a278c7199c4 | diff --git a/podman/tests/unit/test_container.py b/podman/tests/unit/test_container.py
index f7294cf..955f48c 100644
--- a/podman/tests/unit/test_container.py
+++ b/podman/tests/unit/test_container.py
@@ -411,6 +411,53 @@ class ContainersTestCase(unittest.TestCase):
self.assertDictEqual(actual, body)
self.assertTrue(adapter.called_once)
+ @requests_mock.Mocker()
+ def test_top_with_streaming(self, mock):
+ stream = [
+ {
+ "Processes": [
+ [
+ 'jhonce',
+ '2417',
+ '2274',
+ '0',
+ 'Mar01',
+ '?',
+ '00:00:01',
+ (
+ '/usr/bin/ssh-agent /bin/sh -c exec -l /bin/bash -c'
+ ' "/usr/bin/gnome-session"'
+ ),
+ ],
+ ['jhonce', '5544', '3522', '0', 'Mar01', 'pts/1', '00:00:02', '-bash'],
+ ['jhonce', '6140', '3522', '0', 'Mar01', 'pts/2', '00:00:00', '-bash'],
+ ],
+ "Titles": ["UID", "PID", "PPID", "C", "STIME", "TTY", "TIME CMD"],
+ }
+ ]
+
+ buffer = io.StringIO()
+ for entry in stream:
+ buffer.write(json.JSONEncoder().encode(entry))
+ buffer.write("\n")
+
+ adapter = mock.get(
+ tests.LIBPOD_URL
+ + "/containers/87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/top"
+ "?stream=True",
+ text=buffer.getvalue(),
+ )
+
+ container = Container(attrs=FIRST_CONTAINER, client=self.client.api)
+ top_stats = container.top(stream=True)
+
+ self.assertIsInstance(top_stats, Iterable)
+ for response, actual in zip(top_stats, stream):
+ self.assertIsInstance(response, dict)
+ self.assertDictEqual(response, actual)
+
+ self.assertTrue(adapter.called_once)
+
if __name__ == '__main__':
unittest.main()
diff --git a/podman/tests/unit/test_parse_utils.py b/podman/tests/unit/test_parse_utils.py
index 80f30b3..a7768de 100644
--- a/podman/tests/unit/test_parse_utils.py
+++ b/podman/tests/unit/test_parse_utils.py
@@ -1,9 +1,12 @@
import datetime
import ipaddress
+import json
import unittest
-from typing import Any, Optional
-
from dataclasses import dataclass
+from typing import Any, Iterable, Optional, Tuple
+from unittest import mock
+
+from requests import Response
from podman import api
@@ -14,7 +17,7 @@ class ParseUtilsTestCase(unittest.TestCase):
class TestCase:
name: str
input: Any
- expected: Optional[str]
+ expected: Tuple[str, Optional[str]]
cases = [
TestCase(name="empty str", input="", expected=("", None)),
@@ -56,12 +59,36 @@ class ParseUtilsTestCase(unittest.TestCase):
self.assertEqual(api.prepare_timestamp(None), None)
with self.assertRaises(ValueError):
- api.prepare_timestamp("bad input")
+ api.prepare_timestamp("bad input") # type: ignore
def test_prepare_cidr(self):
net = ipaddress.IPv4Network("127.0.0.0/24")
self.assertEqual(api.prepare_cidr(net), ("127.0.0.0", "////AA=="))
+ def test_stream_helper(self):
+ streamed_results = [b'{"test":"val1"}', b'{"test":"val2"}']
+ mock_response = mock.Mock(spec=Response)
+ mock_response.iter_lines.return_value = iter(streamed_results)
+
+ streamable = api.stream_helper(mock_response)
+
+ self.assertIsInstance(streamable, Iterable)
+ for expected, actual in zip(streamed_results, streamable):
+ self.assertIsInstance(actual, bytes)
+ self.assertEqual(expected, actual)
+
+ def test_stream_helper_with_decode(self):
+ streamed_results = [b'{"test":"val1"}', b'{"test":"val2"}']
+ mock_response = mock.Mock(spec=Response)
+ mock_response.iter_lines.return_value = iter(streamed_results)
+
+ streamable = api.stream_helper(mock_response, decode_to_json=True)
+
+ self.assertIsInstance(streamable, Iterable)
+ for expected, actual in zip(streamed_results, streamable):
+ self.assertIsInstance(actual, dict)
+ self.assertDictEqual(json.loads(expected), actual)
+
if __name__ == '__main__':
unittest.main()
| Streaming not supported in Container.top
Current implementation of `top` method on container doesn't support streaming.
If we try to stream, it just hangs up infinitely.
```
Python 3.10.9 (main, Dec 19 2022, 17:35:49) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import podman
>>> client = podman.PodmanClient(base_uri="http+unix:///run/user/1000/podman/podman.sock")
>>> client.containers.list()[0].top(stream=False)
{'Processes': [['mongodb', '1', '0', '0.446', '41m4.487375206s', '?', '11s', 'mongod --bind_ip_all']], 'Titles': ['USER', 'PID', 'PPID', '%CPU', 'ELAPSED', 'TTY', 'TIME', 'COMMAND']}
>>> client.containers.list()[0].top(stream=True)
```
This cause for this issue is similar to #218
Other problems in `top` is that, it decodes non-stream response to json, but sends the streamed responses as plain binary strings.
| 0.0 | 803d2f070f57481b8df234c298cf4a278c7199c4 | [
"[100%]",
"podman/tests/unit/test_parse_utils.py::ParseUtilsTestCase::test_stream_helper_with_decode",
"podman/tests/unit/test_parse_utils.py::ParseUtilsTestCase::test_stream_helper",
"podman/tests/unit/test_container.py::ContainersTestCase::test_top_with_streaming"
]
| [
"[",
"podman/tests/unit/test_parse_utils.py::ParseUtilsTestCase::test_prepare_timestamp",
"podman/tests/unit/test_parse_utils.py::ParseUtilsTestCase::test_parse_repository",
"podman/tests/unit/test_parse_utils.py::ParseUtilsTestCase::test_prepare_cidr",
"podman/tests/unit/test_parse_utils.py::ParseUtilsTestCase::test_decode_header",
"podman/tests/unit/test_container.py::ContainersTestCase::test_put_archive_404",
"podman/tests/unit/test_container.py::ContainersTestCase::test_diff",
"podman/tests/unit/test_container.py::ContainersTestCase::test_stop_304",
"podman/tests/unit/test_container.py::ContainersTestCase::test_wait_condition_interval",
"podman/tests/unit/test_container.py::ContainersTestCase::test_top",
"podman/tests/unit/test_container.py::ContainersTestCase::test_start_dkeys",
"podman/tests/unit/test_container.py::ContainersTestCase::test_rename",
"podman/tests/unit/test_container.py::ContainersTestCase::test_commit",
"podman/tests/unit/test_container.py::ContainersTestCase::test_wait",
"podman/tests/unit/test_container.py::ContainersTestCase::test_diff_404",
"podman/tests/unit/test_container.py::ContainersTestCase::test_remove",
"podman/tests/unit/test_container.py::ContainersTestCase::test_put_archive",
"podman/tests/unit/test_container.py::ContainersTestCase::test_get_archive",
"podman/tests/unit/test_container.py::ContainersTestCase::test_unpause",
"podman/tests/unit/test_container.py::ContainersTestCase::test_stop",
"podman/tests/unit/test_container.py::ContainersTestCase::test_stats",
"podman/tests/unit/test_container.py::ContainersTestCase::test_export",
"podman/tests/unit/test_container.py::ContainersTestCase::test_rename_type_error",
"podman/tests/unit/test_container.py::ContainersTestCase::test_restart",
"podman/tests/unit/test_container.py::ContainersTestCase::test_pause",
"podman/tests/unit/test_container.py::ContainersTestCase::test_start"
]
| {
"failed_lite_validators": [
"has_issue_reference",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2023-03-12 10:11:49+00:00 | apache-2.0 | 1,678 |
|
cookiecutter__cookiecutter-1144 | diff --git a/cookiecutter/vcs.py b/cookiecutter/vcs.py
index ee4feea..417b4ea 100644
--- a/cookiecutter/vcs.py
+++ b/cookiecutter/vcs.py
@@ -70,6 +70,7 @@ def clone(repo_url, checkout=None, clone_to_dir='.', no_input=False):
:param clone_to_dir: The directory to clone to.
Defaults to the current directory.
:param no_input: Suppress all user prompts when calling via API.
+ :returns: str with path to the new directory of the repository.
"""
# Ensure that clone_to_dir exists
clone_to_dir = os.path.expanduser(clone_to_dir)
@@ -84,12 +85,13 @@ def clone(repo_url, checkout=None, clone_to_dir='.', no_input=False):
raise VCSNotInstalled(msg)
repo_url = repo_url.rstrip('/')
- tail = os.path.split(repo_url)[1]
+ repo_name = os.path.split(repo_url)[1]
if repo_type == 'git':
- repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail.rsplit('.git')[0]))
+ repo_name = repo_name.split(':')[-1].rsplit('.git')[0]
+ repo_dir = os.path.normpath(os.path.join(clone_to_dir, repo_name))
elif repo_type == 'hg':
- repo_dir = os.path.normpath(os.path.join(clone_to_dir, tail))
- logger.debug('repo_dir is %s', repo_dir)
+ repo_dir = os.path.normpath(os.path.join(clone_to_dir, repo_name))
+ logger.debug('repo_dir is {0}'.format(repo_dir))
if os.path.isdir(repo_dir):
clone = prompt_and_delete(repo_dir, no_input=no_input)
| cookiecutter/cookiecutter | bc5291e4376dafd1207405f210b5e41991a978fd | diff --git a/tests/vcs/test_clone.py b/tests/vcs/test_clone.py
index 10c625d..41a48a4 100644
--- a/tests/vcs/test_clone.py
+++ b/tests/vcs/test_clone.py
@@ -74,6 +74,9 @@ def test_clone_should_abort_if_user_does_not_want_to_reclone(mocker, tmpdir):
[
('git', 'https://github.com/hello/world.git', 'world'),
('hg', 'https://bitbucket.org/foo/bar', 'bar'),
+ ('git', 'git@host:gitoliterepo', 'gitoliterepo'),
+ ('git', '[email protected]:cookiecutter/cookiecutter.git', 'cookiecutter'),
+ ('git', '[email protected]:cookiecutter/cookiecutter.git', 'cookiecutter'),
],
)
def test_clone_should_invoke_vcs_command(
| Fail with gitolite repository
* Cookiecutter version: 1.6.0
* Template project url: Any
* Python version: Any (tested in 3.7)
* Operating System: Any (testes in ubuntu 16.04 and w$ 10)
### Description:
You are running a gitolite in "gitserver" and have a repository "mytemplate". When you run this::
cookiecutter git clone git@gitserver:mytemplate
You get this fail::
A valid repository for "git@gitserver:mytemplate" could not be found in the following locations:
C:\Users\javier\.cookiecutters\git@gitserver:mytemplate
### What I've run:
```
$ cookiecutter -v --debug-file log.txt git@gitserver:mytemplate
DEBUG cookiecutter.config: config_path is /home/jsanchez/.cookiecutterrc
DEBUG cookiecutter.utils: Making sure path exists: /home/jsanchez/.cookiecutters/
DEBUG cookiecutter.vcs: repo_dir is /home/jsanchez/.cookiecutters/git@gitserver:mytemplate
Clonar en «mytemplate»...
X11 forwarding request failed on channel 0
remote: Counting objects: 142, done.
remote: Compressing objects: 100% (118/118), done.
remote: Total 142 (delta 14), reused 0 (delta 0)
Receiving objects: 100% (142/142), 91.09 KiB | 0 bytes/s, done.
Resolving deltas: 100% (14/14), done.
Comprobando la conectividad… hecho.
A valid repository for "git@gitserver:mytemplate" could not be found in the following locations:
/home/jsanchez/.cookiecutters/git@gitserver:mytemplate
```
The repository mytemplate is correctly cloned in ~/.cookiecutters/mytemplate::
```
$ ls ~/.cookiecutters/cmsc_tmpl_python/
bin cookiecutter.json docs doit.cfg LICENSE poetry.lock README.md tests
CHANGELOG.md {{cookiecutter.project_slug}} dodo.py hooks mkdocs.yml pyproject.toml tasks.txt tox.ini
```
But `repo_dir` points to `~/.cookiecutters/git@gitserver:mytemplate` which don't exists. | 0.0 | bc5291e4376dafd1207405f210b5e41991a978fd | [
"tests/vcs/test_clone.py::test_clone_should_invoke_vcs_command[git-git@host:gitoliterepo-gitoliterepo]"
]
| [
"tests/vcs/test_clone.py::test_clone_should_raise_if_vcs_not_installed",
"tests/vcs/test_clone.py::test_clone_should_rstrip_trailing_slash_in_repo_url",
"tests/vcs/test_clone.py::test_clone_should_abort_if_user_does_not_want_to_reclone",
"tests/vcs/test_clone.py::test_clone_should_invoke_vcs_command[git-https://github.com/hello/world.git-world]",
"tests/vcs/test_clone.py::test_clone_should_invoke_vcs_command[hg-https://bitbucket.org/foo/bar-bar]",
"tests/vcs/test_clone.py::test_clone_should_invoke_vcs_command[[email protected]:cookiecutter/cookiecutter.git-cookiecutter]",
"tests/vcs/test_clone.py::test_clone_should_invoke_vcs_command[[email protected]:cookiecutter/cookiecutter.git-cookiecutter]",
"tests/vcs/test_clone.py::test_clone_handles_repo_typo[fatal:",
"tests/vcs/test_clone.py::test_clone_handles_repo_typo[hg:",
"tests/vcs/test_clone.py::test_clone_handles_branch_typo[error:",
"tests/vcs/test_clone.py::test_clone_handles_branch_typo[hg:",
"tests/vcs/test_clone.py::test_clone_unknown_subprocess_error"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2019-01-28 09:40:30+00:00 | bsd-3-clause | 1,679 |
|
cookiecutter__cookiecutter-1168 | diff --git a/AUTHORS.rst b/AUTHORS.rst
index 8b39d81..a1afb70 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -127,6 +127,7 @@ Contributors
* Jonathan Sick (`@jonathansick`_)
* Hugo (`@hugovk`_)
* Min ho Kim (`@minho42`_)
+* Ryan Ly (`@rly`_)
.. _`@cedk`: https://github.com/cedk
.. _`@johtso`: https://github.com/johtso
@@ -242,3 +243,4 @@ Contributors
.. _`@insspb`: https://github.com/insspb
.. _`@ssbarnea`: https://github.com/ssbarnea
.. _`@minho42`: https://github.com/minho42
+.. _`@rly`: https://github.com/rly
diff --git a/HISTORY.rst b/HISTORY.rst
index a9ccf79..4b5b4c8 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -12,11 +12,14 @@ Important Changes:
`@insspb`_ (#1181).
* Drop support for EOL Python 3.3 thanks to `@hugovk`_ (#1024)
+* Increase the minimum ``click`` version to ``7.0`` (#1168)
+
.. _`@hugovk`: https://github.com/hugovk
Other Changes:
+* Prevent ``click`` API v7.0 from showing choices when already shown thanks to `@rly`_ (#1168)
* Add a `CODE_OF_CONDUCT.md`_ file to the project, thanks to
`@andreagrandi`_ (#1009)
* Update docstrings in ``cookiecutter/main.py``, ``cookiecutter/__init__.py``,
@@ -81,6 +84,7 @@ Other Changes:
.. _`@mashrikt`: https://github.com/mashrikt
.. _`@jamescurtin`: https://github.com/jamescurtin
.. _`@insspb`: https://github.com/insspb
+.. _`@rly`: https://github.com/rly
1.6.0 (2017-10-15) Tim Tam
diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py
index 45a065b..da4ada2 100644
--- a/cookiecutter/prompt.py
+++ b/cookiecutter/prompt.py
@@ -88,7 +88,7 @@ def read_user_choice(var_name, options):
))
user_choice = click.prompt(
- prompt, type=click.Choice(choices), default=default
+ prompt, type=click.Choice(choices), default=default, show_choices=False
)
return choice_map[user_choice]
diff --git a/docs/usage.rst b/docs/usage.rst
index 73164e1..9b7b95f 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -49,7 +49,7 @@ repository::
$ cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git
$ cookiecutter git+ssh://[email protected]/audreyr/cookiecutter-pypackage.git
$ cookiecutter hg+ssh://[email protected]/audreyr/cookiecutter-pypackage
-
+
You will be prompted to enter a bunch of project config values. (These are
defined in the project's `cookiecutter.json`.)
diff --git a/setup.py b/setup.py
index 488234f..d3286b7 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,7 @@ requirements = [
'future>=0.15.2',
'binaryornot>=0.2.0',
'jinja2>=2.7',
- 'click>=5.0',
+ 'click>=7.0',
'whichcraft>=0.4.0',
'poyo>=0.1.0',
'jinja2-time>=0.1.0',
| cookiecutter/cookiecutter | 5c282f020a8db7e5e7c4e7b51b010556ca31fb7f | diff --git a/tests/test_read_user_choice.py b/tests/test_read_user_choice.py
index 0f9e003..0e81c2d 100644
--- a/tests/test_read_user_choice.py
+++ b/tests/test_read_user_choice.py
@@ -29,7 +29,8 @@ def test_click_invocation(mocker, user_choice, expected_value):
prompt.assert_called_once_with(
EXPECTED_PROMPT,
type=click.Choice(OPTIONS),
- default='1'
+ default='1',
+ show_choices=False
)
| Choice options are redundant using cookiecutter with latest click package
* Cookiecutter version: 1.6.0 -- installed via `pip install`
* Template project url: n/a
* Python version: 3.7
* Operating System: Windows 10
### Description:
If cookiecutter.json has the following:
```json
{
"my_choice": ["a","b"]
}
```
Then running cookiecutter gives the following prompt:
```
Select my_choice:
1 - a
2 - b
Choose from 1, 2 (1, 2) [1]:
```
Note how the choices are repeated twice in the last line. This is because the [Click API](https://click.palletsprojects.com/en/7.x/api/) has been updated to 7.0 and automatically shows the choices to the user in parentheses. This is redundant.
### Solution
The text passed to the `click.prompt` function should be changed to set `show_choices = False` or it should be changed to not show the choices and let the Click API do so instead.
| 0.0 | 5c282f020a8db7e5e7c4e7b51b010556ca31fb7f | [
"tests/test_read_user_choice.py::test_click_invocation[1-hello]",
"tests/test_read_user_choice.py::test_click_invocation[2-world]",
"tests/test_read_user_choice.py::test_click_invocation[3-foo]",
"tests/test_read_user_choice.py::test_click_invocation[4-bar]"
]
| [
"tests/test_read_user_choice.py::test_raise_if_options_is_not_a_non_empty_list"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-05-03 22:42:29+00:00 | bsd-3-clause | 1,680 |
|
cookiecutter__cookiecutter-1626 | diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py
index a067d09..003ace6 100644
--- a/cookiecutter/prompt.py
+++ b/cookiecutter/prompt.py
@@ -143,8 +143,8 @@ def render_variable(env, raw, cookiecutter_dict):
being populated with variables.
:return: The rendered value for the default variable.
"""
- if raw is None:
- return None
+ if raw is None or isinstance(raw, bool):
+ return raw
elif isinstance(raw, dict):
return {
render_variable(env, k, cookiecutter_dict): render_variable(
@@ -201,6 +201,14 @@ def prompt_for_config(context, no_input=False):
cookiecutter_dict, env, key, raw, no_input
)
cookiecutter_dict[key] = val
+ elif isinstance(raw, bool):
+ # We are dealing with a boolean variable
+ if no_input:
+ cookiecutter_dict[key] = render_variable(
+ env, raw, cookiecutter_dict
+ )
+ else:
+ cookiecutter_dict[key] = read_user_yes_no(key, raw)
elif not isinstance(raw, dict):
# We are dealing with a regular variable
val = render_variable(env, raw, cookiecutter_dict)
diff --git a/docs/advanced/boolean_variables.rst b/docs/advanced/boolean_variables.rst
new file mode 100644
index 0000000..58c5e48
--- /dev/null
+++ b/docs/advanced/boolean_variables.rst
@@ -0,0 +1,46 @@
+.. _boolean-variables:
+
+Boolean Variables (2.2+)
+------------------------
+
+Boolean variables are used for answering True/False questions.
+
+Basic Usage
+~~~~~~~~~~~
+
+Boolean variables are regular key / value pairs, but with the value being True/False.
+
+For example, if you provide the following boolean variable in your ``cookiecutter.json``::
+
+ {
+ "run_as_docker": true
+ }
+
+you'd get the following user input when running Cookiecutter::
+
+ run_as_docker [True]:
+
+Depending on the user's input, a different condition will be selected.
+
+The above ``run_as_docker`` boolean variable creates ``cookiecutter.run_as_docker``, which
+can be used like this::
+
+ {%- if cookiecutter.run_as_docker -%}
+ # In case of True add your content here
+
+ {%- else -%}
+ # In case of False add your content here
+
+ {% endif %}
+
+Cookiecutter is using `Jinja2's if conditional expression <http://jinja.pocoo.org/docs/dev/templates/#if>`_ to determine the correct ``run_as_docker``.
+
+Input Validation
+~~~~~~~~~~~~~~~~
+If a non valid value is inserted to a boolean field, the following error will be printed:
+
+.. code-block:: bash
+
+ run_as_docker [True]: docker
+ Error: docker is not a valid boolean
+
diff --git a/docs/advanced/index.rst b/docs/advanced/index.rst
index 216731d..89150af 100644
--- a/docs/advanced/index.rst
+++ b/docs/advanced/index.rst
@@ -18,6 +18,7 @@ Various advanced topics regarding cookiecutter usage.
copy_without_render
replay
choice_variables
+ boolean_variables
dict_variables
templates
template_extensions
| cookiecutter/cookiecutter | 558f4404852e22965a21cad964271ea74f73e6f8 | diff --git a/tests/test_prompt.py b/tests/test_prompt.py
index 037591d..9e85bcd 100644
--- a/tests/test_prompt.py
+++ b/tests/test_prompt.py
@@ -21,7 +21,7 @@ class TestRenderVariable:
'raw_var, rendered_var',
[
(1, '1'),
- (True, 'True'),
+ (True, True),
('foo', 'foo'),
('{{cookiecutter.project}}', 'foobar'),
(None, None),
@@ -39,7 +39,7 @@ class TestRenderVariable:
assert result == rendered_var
# Make sure that non None non str variables are converted beforehand
- if raw_var is not None:
+ if raw_var is not None and not isinstance(raw_var, bool):
if not isinstance(raw_var, str):
raw_var = str(raw_var)
from_string.assert_called_once_with(raw_var)
@@ -49,10 +49,10 @@ class TestRenderVariable:
@pytest.mark.parametrize(
'raw_var, rendered_var',
[
- ({1: True, 'foo': False}, {'1': 'True', 'foo': 'False'}),
+ ({1: True, 'foo': False}, {'1': True, 'foo': False}),
(
{'{{cookiecutter.project}}': ['foo', 1], 'bar': False},
- {'foobar': ['foo', '1'], 'bar': 'False'},
+ {'foobar': ['foo', '1'], 'bar': False},
),
(['foo', '{{cookiecutter.project}}', None], ['foo', 'foobar', None]),
],
@@ -380,6 +380,42 @@ class TestPromptChoiceForConfig:
assert expected_choice == actual_choice
+class TestReadUserYesNo(object):
+ """Class to unite boolean prompt related tests."""
+
+ @pytest.mark.parametrize(
+ 'run_as_docker',
+ (
+ True,
+ False,
+ ),
+ )
+ def test_should_invoke_read_user_yes_no(self, mocker, run_as_docker):
+ """Verify correct function called for boolean variables."""
+ read_user_yes_no = mocker.patch('cookiecutter.prompt.read_user_yes_no')
+ read_user_yes_no.return_value = run_as_docker
+
+ read_user_variable = mocker.patch('cookiecutter.prompt.read_user_variable')
+
+ context = {'cookiecutter': {'run_as_docker': run_as_docker}}
+
+ cookiecutter_dict = prompt.prompt_for_config(context)
+
+ assert not read_user_variable.called
+ read_user_yes_no.assert_called_once_with('run_as_docker', run_as_docker)
+ assert cookiecutter_dict == {'run_as_docker': run_as_docker}
+
+ def test_boolean_parameter_no_input(self):
+ """Verify boolean parameter sent to prompt for config with no input."""
+ context = {
+ 'cookiecutter': {
+ 'run_as_docker': True,
+ }
+ }
+ cookiecutter_dict = prompt.prompt_for_config(context, no_input=True)
+ assert cookiecutter_dict == context['cookiecutter']
+
+
@pytest.mark.parametrize(
'context',
(
| Boolean parameters parsed as String
* Cookiecutter version: 2.0
* Template project url: https://github.com/cookiecutter/cookiecutter-django
* Python version: 3.8
* Operating System: Linux
### Description:
We want to be able to ask the user for true/false questions.
The example template shows the current usage of boolean parameters, in {{cookiecutter.project_slug}}/.github/dependabot.yml:
`{%- if cookiecutter.use_docker == 'y' %}`
This usage is rather problematic, as it is requires the user to enter exactly 'y'. If the user enters "yes" or "true" it won't be valid.
We want to add the ability to specify boolean parameters as "true" JSON booleans and naturally prompt for them.
Thus the usage of booleans in the template's cookiecutter.json would look like:
`"use_docker": false`
Instead of the current usage, which is:
`"use_docker": "n"`
Currently this example boolean which is specified in the cookiecutter.json file is parsed as a string and thus checking for it would require a string comparison, which raises and exact same problem as the user would have to explicitly enter "true" or "false" instead of a boolean.
This would also simplify the usage of the boolean parameters in files, so the above shown dependabot.yml would change to:
`{%- if cookiecutter.use_docker %}` | 0.0 | 558f4404852e22965a21cad964271ea74f73e6f8 | [
"tests/test_prompt.py::TestRenderVariable::test_convert_to_str[True-True]",
"tests/test_prompt.py::TestRenderVariable::test_convert_to_str_complex_variables[raw_var0-rendered_var0]",
"tests/test_prompt.py::TestRenderVariable::test_convert_to_str_complex_variables[raw_var1-rendered_var1]",
"tests/test_prompt.py::TestReadUserYesNo::test_should_invoke_read_user_yes_no[True]",
"tests/test_prompt.py::TestReadUserYesNo::test_should_invoke_read_user_yes_no[False]",
"tests/test_prompt.py::TestReadUserYesNo::test_boolean_parameter_no_input"
]
| [
"tests/test_prompt.py::TestRenderVariable::test_convert_to_str[1-1]",
"tests/test_prompt.py::TestRenderVariable::test_convert_to_str[foo-foo]",
"tests/test_prompt.py::TestRenderVariable::test_convert_to_str[{{cookiecutter.project}}-foobar]",
"tests/test_prompt.py::TestRenderVariable::test_convert_to_str[None-None]",
"tests/test_prompt.py::TestRenderVariable::test_convert_to_str_complex_variables[raw_var2-rendered_var2]",
"tests/test_prompt.py::TestPrompt::test_prompt_for_config[ASCII",
"tests/test_prompt.py::TestPrompt::test_prompt_for_config[Unicode",
"tests/test_prompt.py::TestPrompt::test_prompt_for_config_dict",
"tests/test_prompt.py::TestPrompt::test_should_render_dict",
"tests/test_prompt.py::TestPrompt::test_should_render_deep_dict",
"tests/test_prompt.py::TestPrompt::test_prompt_for_templated_config",
"tests/test_prompt.py::TestPrompt::test_dont_prompt_for_private_context_var",
"tests/test_prompt.py::TestPrompt::test_should_render_private_variables_with_two_underscores",
"tests/test_prompt.py::TestPrompt::test_should_not_render_private_variables",
"tests/test_prompt.py::TestReadUserChoice::test_should_invoke_read_user_choice",
"tests/test_prompt.py::TestReadUserChoice::test_should_invoke_read_user_variable",
"tests/test_prompt.py::TestReadUserChoice::test_should_render_choices",
"tests/test_prompt.py::TestPromptChoiceForConfig::test_should_return_first_option_if_no_input",
"tests/test_prompt.py::TestPromptChoiceForConfig::test_should_read_user_choice",
"tests/test_prompt.py::test_undefined_variable[Undefined"
]
| {
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-12-19 22:48:20+00:00 | bsd-3-clause | 1,681 |
|
cookiecutter__cookiecutter-1920 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 44c7128..3ea51b4 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,8 +10,8 @@ repos:
language: python
files: \.rst$
require_serial: true
- - repo: https://github.com/psf/black.git
- rev: 23.7.0
+ - repo: https://github.com/psf/black-pre-commit-mirror
+ rev: 23.9.1
hooks:
- id: black
language_version: python3
diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py
index f5c2824..16830d4 100644
--- a/cookiecutter/prompt.py
+++ b/cookiecutter/prompt.py
@@ -20,7 +20,13 @@ def read_user_variable(var_name, default_value, prompts=None, prefix=""):
if prompts and var_name in prompts.keys() and prompts[var_name]
else var_name
)
- return Prompt.ask(f"{prefix}{question}", default=default_value)
+
+ while True:
+ variable = Prompt.ask(f"{prefix}{question}", default=default_value)
+ if variable is not None:
+ break
+
+ return variable
class YesNoPrompt(Confirm):
@@ -243,8 +249,10 @@ def prompt_for_config(context, no_input=False):
# values might refer to them.
count = 0
- size = len(context['cookiecutter'].items())
- for key, raw in context['cookiecutter'].items():
+ all_prompts = context['cookiecutter'].items()
+ visible_prompts = [k for k, _ in all_prompts if not k.startswith("_")]
+ size = len(visible_prompts)
+ for key, raw in all_prompts:
if key.startswith('_') and not key.startswith('__'):
cookiecutter_dict[key] = raw
continue
diff --git a/docs/advanced/human_readable_prompts.rst b/docs/advanced/human_readable_prompts.rst
index ee30e12..51ebc92 100644
--- a/docs/advanced/human_readable_prompts.rst
+++ b/docs/advanced/human_readable_prompts.rst
@@ -22,15 +22,15 @@ See the following cookiecutter config as example:
"init_git": true,
"linting": ["ruff", "flake8", "none"],
"__prompts__": {
- "package_name": "Select your package name:",
- "module_name": "Select your module name:",
- "package_name_stylized": "Stylized package name:",
- "short_description": "Short description:",
- "github_username": "GitHub username or organization:",
- "full_name": "Author full name:",
- "email": "Author email:",
- "command_line_interface": "Add CLI:",
- "init_git": "Initialize a git repository:",
+ "package_name": "Select your package name",
+ "module_name": "Select your module name",
+ "package_name_stylized": "Stylized package name",
+ "short_description": "Short description",
+ "github_username": "GitHub username or organization",
+ "full_name": "Author full name",
+ "email": "Author email",
+ "command_line_interface": "Add CLI",
+ "init_git": "Initialize a git repository",
"linting": {
"__prompt__": "Which linting tool do you want to use?",
"ruff": "Ruff",
diff --git a/docs/installation.rst b/docs/installation.rst
index 995fd07..00e8d5f 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -104,6 +104,12 @@ Alternate installations
brew install cookiecutter
+**Void Linux:**
+
+.. code-block:: bash
+
+ xbps-install cookiecutter
+
**Pipx (Linux, OSX and Windows):**
.. code-block:: bash
diff --git a/docs/tutorials/tutorial2.rst b/docs/tutorials/tutorial2.rst
index d16f6b7..0a93191 100644
--- a/docs/tutorials/tutorial2.rst
+++ b/docs/tutorials/tutorial2.rst
@@ -66,7 +66,7 @@ By running following command `cookiecutter.zip` will get generated which can be
.. code-block:: bash
$ (SOURCE_DIR=$(basename $PWD) ZIP=cookiecutter.zip && # Set variables
- pushd && # Set parent directory as working directory
+ pushd .. && # Set parent directory as working directory
zip -r $ZIP $SOURCE_DIR --exclude $SOURCE_DIR/$ZIP --quiet && # ZIP cookiecutter
mv $ZIP $SOURCE_DIR/$ZIP && # Move ZIP to original directory
popd && # Restore original work directory
| cookiecutter/cookiecutter | 1b8520e7075175db4a3deae85e71081730ca7ad1 | diff --git a/tests/test_read_user_variable.py b/tests/test_read_user_variable.py
index 02890a1..6fac4d3 100644
--- a/tests/test_read_user_variable.py
+++ b/tests/test_read_user_variable.py
@@ -1,18 +1,36 @@
"""test_read_user_variable."""
+import pytest
from cookiecutter.prompt import read_user_variable
VARIABLE = 'project_name'
DEFAULT = 'Kivy Project'
-def test_click_invocation(mocker):
[email protected]
+def mock_prompt(mocker):
+ """Return a mocked version of the 'Prompt.ask' function."""
+ return mocker.patch('rich.prompt.Prompt.ask')
+
+
+def test_click_invocation(mock_prompt):
"""Test click function called correctly by cookiecutter.
Test for string type invocation.
"""
- prompt = mocker.patch('rich.prompt.Prompt.ask')
- prompt.return_value = DEFAULT
+ mock_prompt.return_value = DEFAULT
assert read_user_variable(VARIABLE, DEFAULT) == DEFAULT
- prompt.assert_called_once_with(VARIABLE, default=DEFAULT)
+ mock_prompt.assert_called_once_with(VARIABLE, default=DEFAULT)
+
+
+def test_input_loop_with_null_default_value(mock_prompt):
+ """Test `Prompt.ask` is run repeatedly until a valid answer is provided.
+
+ Test for `default_value` parameter equal to None.
+ """
+ # Simulate user providing None input initially and then a valid input
+ mock_prompt.side_effect = [None, DEFAULT]
+
+ assert read_user_variable(VARIABLE, None) == DEFAULT
+ assert mock_prompt.call_count == 2
| Variable with null default no longer being required
* Cookiecutter version: 2.3.0
* Template project url: internal
* Python version: Python 3.8.12
* Operating System: Debian GNU/Linux 11
### Description:
After updating from 2.1.1 to 2.3.0, setting a field's default value in `cookiecutter.json` to `null` no longer makes that field required. It instead passes `None` as the value of that variable. Previously, it would repeat that prompt until you gave it a value.
It looks like this happened in the switch from `click` to `rich` in 2.3.0 - `click` doesn't allow a prompt without a default value to be empty (there's [a `while True` loop](https://github.com/pallets/click/blob/388b0e14093355e30b17ffaff0c7588533d9dbc8/src/click/termui.py#L163)), while `rich` does ([it just casts the input and makes sure it doesn't cause a ValueError](https://github.com/Textualize/rich/blob/720800e6930d85ad027b1e9bd0cbb96b5e994ce3/rich/prompt.py#L230) -- which it doesn't, as `str(None)=="None"`). It seems like, with `rich`, you have to handle that logic yourself.
### What I've run:
An example (`component_name`'s value is `null`, `service_name`'s is `test`):
```
Template 1:
[1/8] component_name:
[2/8] service_name (test): ^C
Aborted!
```
Compare to output with version 2.1.1:
```
Template 1:
component_name:
component_name:
component_name: test
service_name [test]: ^CAborted!
``` | 0.0 | 1b8520e7075175db4a3deae85e71081730ca7ad1 | [
"tests/test_read_user_variable.py::test_input_loop_with_null_default_value"
]
| [
"tests/test_read_user_variable.py::test_click_invocation"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2023-08-13 09:09:44+00:00 | bsd-3-clause | 1,682 |
|
cookiecutter__cookiecutter-2029 | diff --git a/cookiecutter/generate.py b/cookiecutter/generate.py
index 14a96e6..48aacb6 100644
--- a/cookiecutter/generate.py
+++ b/cookiecutter/generate.py
@@ -15,6 +15,7 @@ from typing import Any
from binaryornot.check import is_binary
from jinja2 import Environment, FileSystemLoader
from jinja2.exceptions import TemplateSyntaxError, UndefinedError
+from rich.prompt import InvalidResponse
from cookiecutter.exceptions import (
ContextDecodingException,
@@ -24,6 +25,7 @@ from cookiecutter.exceptions import (
)
from cookiecutter.find import find_template
from cookiecutter.hooks import run_hook_from_repo_dir
+from cookiecutter.prompt import YesNoPrompt
from cookiecutter.utils import (
create_env_with_context,
make_sure_path_exists,
@@ -103,6 +105,16 @@ def apply_overwrites_to_context(
context_value, overwrite, in_dictionary_variable=True
)
context[variable] = context_value
+ elif isinstance(context_value, bool) and isinstance(overwrite, str):
+ # We are dealing with a boolean variable
+ # Convert overwrite to its boolean counterpart
+ try:
+ context[variable] = YesNoPrompt().process_response(overwrite)
+ except InvalidResponse as err:
+ raise ValueError(
+ f"{overwrite} provided for variable "
+ f"{variable} could not be converted to a boolean."
+ ) from err
else:
# Simply overwrite the value for this variable
context[variable] = overwrite
| cookiecutter/cookiecutter | 9f94bceed2301659fbc64b20deb7f96a81ac42f8 | diff --git a/tests/test_generate_context.py b/tests/test_generate_context.py
index 6cc5c13..fe29353 100644
--- a/tests/test_generate_context.py
+++ b/tests/test_generate_context.py
@@ -8,6 +8,7 @@ import pytest
from cookiecutter import generate
from cookiecutter.exceptions import ContextDecodingException
+from cookiecutter.prompt import YesNoPrompt
def context_data():
@@ -362,3 +363,24 @@ def test_apply_overwrites_in_nested_dict_additional_values() -> None:
)
assert generated_context == expected_context
+
+
[email protected](
+ "overwrite_value, expected",
+ [(bool_string, {'key': True}) for bool_string in YesNoPrompt.yes_choices]
+ + [(bool_string, {'key': False}) for bool_string in YesNoPrompt.no_choices],
+)
+def test_apply_overwrites_overwrite_value_as_boolean_string(overwrite_value, expected):
+ """Verify boolean conversion for valid overwrite values."""
+ context = {'key': not expected['key']}
+ overwrite_context = {'key': overwrite_value}
+ generate.apply_overwrites_to_context(context, overwrite_context)
+ assert context == expected
+
+
+def test_apply_overwrites_error_overwrite_value_as_boolean_string():
+ """Verify boolean conversion for invalid overwrite values."""
+ context = {'key': True}
+ overwrite_context = {'key': 'invalid'}
+ with pytest.raises(ValueError):
+ generate.apply_overwrites_to_context(context, overwrite_context)
| Cannot properly override boolean variable from command line
* Cookiecutter version: 2.4.0
* Template project url: N/A
* Python version: 3.10
* Operating System: Linux
### Description:
I tried to use the boolean variable. It works great when generating from interactive prompt. But when I try to use --no-input with command line context it doesn't propagate words like "no" or "false" as false value, but rather it seems to take it as string value, so if I pass an empty string it will be evaluated to false.
Here is my cookiecutter.json:
```json
{
"project_name": "test_boolean",
"generate_text": true
}
```
I have a file with template:
```
{% if cookiecutter.generate_text %}
Hello, world!
{% endif %}
```
If I run `cookiecutter --no-input -f . generate_text=false`, the generated file still has the "Hello, world!". But if i use `generate_text=""` the generated file will be empty. | 0.0 | 9f94bceed2301659fbc64b20deb7f96a81ac42f8 | [
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[1-expected0]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[true-expected1]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[t-expected2]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[yes-expected3]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[y-expected4]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[on-expected5]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[0-expected6]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[false-expected7]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[f-expected8]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[no-expected9]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[n-expected10]",
"tests/test_generate_context.py::test_apply_overwrites_overwrite_value_as_boolean_string[off-expected11]",
"tests/test_generate_context.py::test_apply_overwrites_error_overwrite_value_as_boolean_string"
]
| [
"tests/test_generate_context.py::test_generate_context[input_params0-expected_context0]",
"tests/test_generate_context.py::test_generate_context[input_params1-expected_context1]",
"tests/test_generate_context.py::test_generate_context[input_params2-expected_context2]",
"tests/test_generate_context.py::test_generate_context[input_params3-expected_context3]",
"tests/test_generate_context.py::test_generate_context_with_json_decoding_error",
"tests/test_generate_context.py::test_default_context_replacement_in_generate_context",
"tests/test_generate_context.py::test_generate_context_decodes_non_ascii_chars",
"tests/test_generate_context.py::test_apply_overwrites_does_include_unused_variables",
"tests/test_generate_context.py::test_apply_overwrites_sets_non_list_value",
"tests/test_generate_context.py::test_apply_overwrites_does_not_modify_choices_for_invalid_overwrite",
"tests/test_generate_context.py::test_apply_overwrites_invalid_overwrite",
"tests/test_generate_context.py::test_apply_overwrites_sets_multichoice_values",
"tests/test_generate_context.py::test_apply_overwrites_invalid_multichoice_values",
"tests/test_generate_context.py::test_apply_overwrites_error_additional_values",
"tests/test_generate_context.py::test_apply_overwrites_in_dictionaries",
"tests/test_generate_context.py::test_apply_overwrites_sets_default_for_choice_variable",
"tests/test_generate_context.py::test_apply_overwrites_in_nested_dict",
"tests/test_generate_context.py::test_apply_overwrite_context_as_in_nested_dict_with_additional_values",
"tests/test_generate_context.py::test_apply_overwrites_in_nested_dict_additional_values"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2024-03-06 06:42:32+00:00 | bsd-3-clause | 1,683 |
|
cookiecutter__cookiecutter-839 | diff --git a/cookiecutter/generate.py b/cookiecutter/generate.py
index 4739aec..4656a4f 100644
--- a/cookiecutter/generate.py
+++ b/cookiecutter/generate.py
@@ -323,6 +323,7 @@ def generate_files(
for copy_dir in copy_dirs:
indir = os.path.normpath(os.path.join(root, copy_dir))
outdir = os.path.normpath(os.path.join(project_dir, indir))
+ outdir = env.from_string(outdir).render(**context)
logger.debug('Copying dir %s to %s without rendering', indir, outdir)
shutil.copytree(indir, outdir)
diff --git a/docs/advanced/copy_without_render.rst b/docs/advanced/copy_without_render.rst
index a804032..2cdb680 100644
--- a/docs/advanced/copy_without_render.rst
+++ b/docs/advanced/copy_without_render.rst
@@ -15,3 +15,14 @@ To avoid rendering directories and files of a cookiecutter, the `_copy_without_r
"rendered_dir/not_rendered_file.ini"
]
}
+
+**Note**: Only the content of the files will be copied without being rendered. The paths are subject to rendering. This allows you to write::
+
+ {
+ "project_slug": "sample",
+ "_copy_without_render": [
+ "{{cookiecutter.repo_name}}/templates/*.html",
+ ]
+ }
+
+In this example, `{{cookiecutter.repo_name}}` will be rendered as expected but the html file content will be copied without rendering.
| cookiecutter/cookiecutter | d8672b11e445a918431933c322e7ac96440fd438 | diff --git a/tests/test-generate-copy-without-render/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}-rendered/README.md b/tests/test-generate-copy-without-render/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}-rendered/README.md
new file mode 100644
index 0000000..0e74081
--- /dev/null
+++ b/tests/test-generate-copy-without-render/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}-rendered/README.md
@@ -0,0 +1,3 @@
+# Fake Project
+
+{{cookiecutter.render_test}}
diff --git a/tests/test_generate_copy_without_render.py b/tests/test_generate_copy_without_render.py
index 0e2a944..7d61482 100644
--- a/tests/test_generate_copy_without_render.py
+++ b/tests/test_generate_copy_without_render.py
@@ -31,6 +31,7 @@ def test_generate_copy_without_render_extensions():
'*not-rendered',
'rendered/not_rendered.yml',
'*.txt',
+ '{{cookiecutter.repo_name}}-rendered/README.md',
],
}
},
@@ -39,7 +40,7 @@ def test_generate_copy_without_render_extensions():
dir_contents = os.listdir('test_copy_without_render')
- assert '{{cookiecutter.repo_name}}-not-rendered' in dir_contents
+ assert 'test_copy_without_render-not-rendered' in dir_contents
assert 'test_copy_without_render-rendered' in dir_contents
with open('test_copy_without_render/README.txt') as f:
@@ -59,9 +60,16 @@ def test_generate_copy_without_render_extensions():
assert 'I have been rendered' in f.read()
with open(
- 'test_copy_without_render/{{cookiecutter.repo_name}}-not-rendered/README.rst'
+ 'test_copy_without_render/'
+ 'test_copy_without_render-not-rendered/'
+ 'README.rst'
) as f:
assert '{{cookiecutter.render_test}}' in f.read()
with open('test_copy_without_render/rendered/not_rendered.yml') as f:
assert '{{cookiecutter.render_test}}' in f.read()
+
+ with open(
+ 'test_copy_without_render/' 'test_copy_without_render-rendered/' 'README.md'
+ ) as f:
+ assert '{{cookiecutter.render_test}}' in f.read()
| Allow for copy_without_render to render output directory name
I find it strange that copy_without_render doesn't render the directory name.
An example use case is wanting to copy a templates directory in your project that contains jinja, the directory is copied however it is placed into a folder like '{{cookiecutter.repo_name}}/templates' as opposed to 'someproject/templates'
I understand some people may in fact want this, but maybe an option to to toggle this behavior would welcome.
| 0.0 | d8672b11e445a918431933c322e7ac96440fd438 | [
"tests/test_generate_copy_without_render.py::test_generate_copy_without_render_extensions"
]
| []
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2016-10-23 11:15:56+00:00 | bsd-3-clause | 1,684 |
|
cool-RR__PySnooper-147 | diff --git a/pysnooper/tracer.py b/pysnooper/tracer.py
index 5d91aeb..fb6eddc 100644
--- a/pysnooper/tracer.py
+++ b/pysnooper/tracer.py
@@ -214,6 +214,9 @@ class Tracer:
self.target_codes = set()
self.target_frames = set()
self.thread_local = threading.local()
+ if len(custom_repr) == 2 and not all(isinstance(x,
+ pycompat.collections_abc.Iterable) for x in custom_repr):
+ custom_repr = (custom_repr,)
self.custom_repr = custom_repr
def __call__(self, function):
| cool-RR/PySnooper | 81868cd0ba676035172a2ad493253c8c6ac9b4d4 | diff --git a/tests/test_pysnooper.py b/tests/test_pysnooper.py
index 0b93845..930dd5d 100644
--- a/tests/test_pysnooper.py
+++ b/tests/test_pysnooper.py
@@ -1174,6 +1174,30 @@ def test_custom_repr():
)
)
+def test_custom_repr_single():
+ string_io = io.StringIO()
+
+ @pysnooper.snoop(string_io, custom_repr=(list, lambda l: 'foofoo!'))
+ def sum_to_x(x):
+ l = list(range(x))
+ return 7
+
+ result = sum_to_x(10000)
+
+ output = string_io.getvalue()
+ assert_output(
+ output,
+ (
+ VariableEntry('x', '10000'),
+ CallEntry(),
+ LineEntry(),
+ VariableEntry('l', 'foofoo!'),
+ LineEntry(),
+ ReturnEntry(),
+ ReturnValueEntry('7'),
+ )
+ )
+
def test_disable():
string_io = io.StringIO()
| Problem with passing in a single tuple in custom_repr= ()
I was trying it on a toy example and just wanted to pass in one tuple like
(list, print_list_size) to custom_repr= () with print_list_size being the example used in the readme file:
`
def print_list_size(l):
return 'list(size={})'.format(len(l))
`
There was an exception:" TypeError: cannot unpack non-iterable function object."
I think the problem lies in that custom_repr is a tuple of tuples thus when it has only one element it won't be unpacked successfully.
I changed custom_repr = [ ] and then put in the tuple (list, print_list_size) and it worked. Or, put an extra , in the tuple such like this:
`
@pysnooper.snoop(custom_repr = ( (list, print_list_size), ))
`
Just a small issue but hopefully this would be beneficial for other people.
| 0.0 | 81868cd0ba676035172a2ad493253c8c6ac9b4d4 | [
"tests/test_pysnooper.py::test_custom_repr_single"
]
| [
"tests/test_pysnooper.py::test_string_io",
"tests/test_pysnooper.py::test_thread_info",
"tests/test_pysnooper.py::test_multi_thread_info",
"tests/test_pysnooper.py::test_callable",
"tests/test_pysnooper.py::test_watch",
"tests/test_pysnooper.py::test_watch_explode",
"tests/test_pysnooper.py::test_variables_classes",
"tests/test_pysnooper.py::test_single_watch_no_comma",
"tests/test_pysnooper.py::test_long_variable",
"tests/test_pysnooper.py::test_repr_exception",
"tests/test_pysnooper.py::test_depth",
"tests/test_pysnooper.py::test_method_and_prefix",
"tests/test_pysnooper.py::test_file_output",
"tests/test_pysnooper.py::test_confusing_decorator_lines",
"tests/test_pysnooper.py::test_lambda",
"tests/test_pysnooper.py::test_unavailable_source",
"tests/test_pysnooper.py::test_no_overwrite_by_default",
"tests/test_pysnooper.py::test_overwrite",
"tests/test_pysnooper.py::test_error_in_overwrite_argument",
"tests/test_pysnooper.py::test_needs_parentheses",
"tests/test_pysnooper.py::test_with_block",
"tests/test_pysnooper.py::test_with_block_depth",
"tests/test_pysnooper.py::test_cellvars",
"tests/test_pysnooper.py::test_var_order",
"tests/test_pysnooper.py::test_truncate",
"tests/test_pysnooper.py::test_indentation",
"tests/test_pysnooper.py::test_exception",
"tests/test_pysnooper.py::test_generator",
"tests/test_pysnooper.py::test_custom_repr",
"tests/test_pysnooper.py::test_disable"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2019-07-30 07:58:33+00:00 | mit | 1,685 |
|
cool-RR__PySnooper-65 | diff --git a/README.md b/README.md
index 331488c..9b43596 100644
--- a/README.md
+++ b/README.md
@@ -149,6 +149,9 @@ On multi-threaded apps identify which thread are snooped in output::
@pysnooper.snoop(thread_info=True)
```
+PySnooper supports decorating generators.
+
+
# Installation #
You can install **PySnooper** by:
diff --git a/pysnooper/pycompat.py b/pysnooper/pycompat.py
index 4f2a9a6..b63df9d 100644
--- a/pysnooper/pycompat.py
+++ b/pysnooper/pycompat.py
@@ -4,6 +4,7 @@
import abc
import os
+import inspect
if hasattr(abc, 'ABC'):
ABC = abc.ABC
@@ -35,3 +36,9 @@ else:
(hasattr(subclass, 'open') and
'path' in subclass.__name__.lower())
)
+
+
+try:
+ iscoroutinefunction = inspect.iscoroutinefunction
+except AttributeError:
+ iscoroutinefunction = lambda whatever: False # Lolz
diff --git a/pysnooper/tracer.py b/pysnooper/tracer.py
index 844809d..b05b0f9 100644
--- a/pysnooper/tracer.py
+++ b/pysnooper/tracer.py
@@ -209,11 +209,32 @@ class Tracer:
self.target_codes.add(function.__code__)
@functools.wraps(function)
- def inner(*args, **kwargs):
+ def simple_wrapper(*args, **kwargs):
with self:
return function(*args, **kwargs)
- return inner
+ @functools.wraps(function)
+ def generator_wrapper(*args, **kwargs):
+ gen = function(*args, **kwargs)
+ method, incoming = gen.send, None
+ while True:
+ with self:
+ try:
+ outgoing = method(incoming)
+ except StopIteration:
+ return
+ try:
+ method, incoming = gen.send, (yield outgoing)
+ except Exception as e:
+ method, incoming = gen.throw, e
+
+ if pycompat.iscoroutinefunction(function):
+ # return decorate(function, coroutine_wrapper)
+ raise NotImplementedError
+ elif inspect.isgeneratorfunction(function):
+ return generator_wrapper
+ else:
+ return simple_wrapper
def write(self, s):
if self.overwrite and not self._did_overwrite:
| cool-RR/PySnooper | 669863a65f3252ecec7109ca547acaae45bb4623 | diff --git a/tests/test_pysnooper.py b/tests/test_pysnooper.py
index d3882e4..4691cfb 100644
--- a/tests/test_pysnooper.py
+++ b/tests/test_pysnooper.py
@@ -5,6 +5,7 @@ import io
import textwrap
import threading
import types
+import sys
from pysnooper.utils import truncate
from python_toolbox import sys_tools, temp_file_tools
@@ -1047,3 +1048,86 @@ def test_indentation():
def test_exception():
from .samples import exception
assert_sample_output(exception)
+
+
+def test_generator():
+ string_io = io.StringIO()
+ original_tracer = sys.gettrace()
+ original_tracer_active = lambda: (sys.gettrace() is original_tracer)
+
+
+ @pysnooper.snoop(string_io)
+ def f(x1):
+ assert not original_tracer_active()
+ x2 = (yield x1)
+ assert not original_tracer_active()
+ x3 = 'foo'
+ assert not original_tracer_active()
+ x4 = (yield 2)
+ assert not original_tracer_active()
+ return
+
+
+ assert original_tracer_active()
+ generator = f(0)
+ assert original_tracer_active()
+ first_item = next(generator)
+ assert original_tracer_active()
+ assert first_item == 0
+ second_item = generator.send('blabla')
+ assert original_tracer_active()
+ assert second_item == 2
+ with pytest.raises(StopIteration) as exc_info:
+ generator.send('looloo')
+ assert original_tracer_active()
+
+ output = string_io.getvalue()
+ assert_output(
+ output,
+ (
+ VariableEntry('x1', '0'),
+ VariableEntry(),
+ CallEntry(),
+ LineEntry(),
+ VariableEntry(),
+ VariableEntry(),
+ LineEntry(),
+ ReturnEntry(),
+ ReturnValueEntry('0'),
+
+ # Pause and resume:
+
+ VariableEntry('x1', '0'),
+ VariableEntry(),
+ VariableEntry(),
+ VariableEntry(),
+ CallEntry(),
+ VariableEntry('x2', "'blabla'"),
+ LineEntry(),
+ LineEntry(),
+ VariableEntry('x3', "'foo'"),
+ LineEntry(),
+ LineEntry(),
+ ReturnEntry(),
+ ReturnValueEntry('2'),
+
+ # Pause and resume:
+
+ VariableEntry('x1', '0'),
+ VariableEntry(),
+ VariableEntry(),
+ VariableEntry(),
+ VariableEntry(),
+ VariableEntry(),
+ CallEntry(),
+ VariableEntry('x4', "'looloo'"),
+ LineEntry(),
+ LineEntry(),
+ ReturnEntry(),
+ ReturnValueEntry(None),
+
+ )
+ )
+
+
+
| Feature request: Support generators
See the conversation on #31 . | 0.0 | 669863a65f3252ecec7109ca547acaae45bb4623 | [
"tests/test_pysnooper.py::test_generator"
]
| [
"tests/test_pysnooper.py::test_string_io",
"tests/test_pysnooper.py::test_thread_info",
"tests/test_pysnooper.py::test_multi_thread_info",
"tests/test_pysnooper.py::test_callable",
"tests/test_pysnooper.py::test_watch",
"tests/test_pysnooper.py::test_watch_explode",
"tests/test_pysnooper.py::test_variables_classes",
"tests/test_pysnooper.py::test_single_watch_no_comma",
"tests/test_pysnooper.py::test_long_variable",
"tests/test_pysnooper.py::test_repr_exception",
"tests/test_pysnooper.py::test_depth",
"tests/test_pysnooper.py::test_method_and_prefix",
"tests/test_pysnooper.py::test_file_output",
"tests/test_pysnooper.py::test_confusing_decorator_lines",
"tests/test_pysnooper.py::test_lambda",
"tests/test_pysnooper.py::test_unavailable_source",
"tests/test_pysnooper.py::test_no_overwrite_by_default",
"tests/test_pysnooper.py::test_overwrite",
"tests/test_pysnooper.py::test_error_in_overwrite_argument",
"tests/test_pysnooper.py::test_needs_parentheses",
"tests/test_pysnooper.py::test_with_block",
"tests/test_pysnooper.py::test_with_block_depth",
"tests/test_pysnooper.py::test_cellvars",
"tests/test_pysnooper.py::test_var_order",
"tests/test_pysnooper.py::test_truncate",
"tests/test_pysnooper.py::test_indentation",
"tests/test_pysnooper.py::test_exception"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-04-27 01:00:59+00:00 | mit | 1,686 |
|
cool-RR__PySnooper-90 | diff --git a/pysnooper/__init__.py b/pysnooper/__init__.py
index ef8dfef..4049c67 100644
--- a/pysnooper/__init__.py
+++ b/pysnooper/__init__.py
@@ -1,5 +1,20 @@
# Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
+"""PySnooper - Never use print for debugging again
+
+Usage:
+
+ import pysnooper
+
+ @pysnooper.snoop()
+ def number_to_bits(number):
+ ...
+
+A log will be written to stderr showing the lines executed and variables
+changed in the decorated function.
+
+For more information, see https://github.com/cool-RR/PySnooper
+"""
from .pysnooper import snoop
from .variables import Attrs, Exploding, Indices, Keys
diff --git a/pysnooper/variables.py b/pysnooper/variables.py
index 6a97666..f3db008 100644
--- a/pysnooper/variables.py
+++ b/pysnooper/variables.py
@@ -7,11 +7,22 @@ from . import utils
from . import pycompat
+def needs_parentheses(source):
+ def code(s):
+ return compile(s, '<variable>', 'eval').co_code
+
+ return code('{}.x'.format(source)) != code('({}).x'.format(source))
+
+
class BaseVariable(pycompat.ABC):
def __init__(self, source, exclude=()):
self.source = source
self.exclude = utils.ensure_tuple(exclude)
self.code = compile(source, '<variable>', 'eval')
+ if needs_parentheses(source):
+ self.unambiguous_source = '({})'.format(source)
+ else:
+ self.unambiguous_source = source
def items(self, frame):
try:
@@ -36,7 +47,7 @@ class CommonVariable(BaseVariable):
except Exception:
continue
result.append((
- '({}){}'.format(self.source, self._format_key(key)),
+ '{}{}'.format(self.unambiguous_source, self._format_key(key)),
utils.get_shortish_repr(value)
))
return result
| cool-RR/PySnooper | 53b3ea13b8ecf52da80daf952a7df02d531a95a8 | diff --git a/tests/test_pysnooper.py b/tests/test_pysnooper.py
index f5ade3d..c9586b8 100644
--- a/tests/test_pysnooper.py
+++ b/tests/test_pysnooper.py
@@ -9,6 +9,7 @@ from python_toolbox import sys_tools, temp_file_tools
import pytest
import pysnooper
+from pysnooper.variables import needs_parentheses
from .utils import (assert_output, VariableEntry, CallEntry, LineEntry,
ReturnEntry, OpcodeEntry, ReturnValueEntry, ExceptionEntry)
@@ -132,7 +133,7 @@ def test_watch_explode():
self.y = y
- @pysnooper.snoop(watch_explode=('_d', '_point', 'lst'))
+ @pysnooper.snoop(watch_explode=('_d', '_point', 'lst + []'))
def my_function():
_d = {'a': 1, 'b': 2, 'c': 'ignore'}
_point = Foo(x=3, y=4)
@@ -150,22 +151,24 @@ def test_watch_explode():
VariableEntry('Foo'),
CallEntry('def my_function():'),
LineEntry(),
- VariableEntry("(_d)['a']", '1'),
- VariableEntry("(_d)['b']", '2'),
- VariableEntry("(_d)['c']", "'ignore'"),
VariableEntry('_d'),
+ VariableEntry("_d['a']", '1'),
+ VariableEntry("_d['b']", '2'),
+ VariableEntry("_d['c']", "'ignore'"),
LineEntry(),
- VariableEntry('(_point).x', '3'),
- VariableEntry('(_point).y', '4'),
VariableEntry('_point'),
+ VariableEntry('_point.x', '3'),
+ VariableEntry('_point.y', '4'),
LineEntry(),
- VariableEntry('(lst)[0]', '7'),
- VariableEntry('(lst)[1]', '8'),
- VariableEntry('(lst)[2]', '9'),
+ VariableEntry('(lst + [])[0]', '7'),
+ VariableEntry('(lst + [])[1]', '8'),
+ VariableEntry('(lst + [])[2]', '9'),
VariableEntry('lst'),
+ VariableEntry('lst + []'),
LineEntry(),
- VariableEntry('(lst)[3]', '10'),
+ VariableEntry('(lst + [])[3]', '10'),
VariableEntry('lst'),
+ VariableEntry('lst + []'),
ReturnEntry(),
ReturnValueEntry('None')
)
@@ -202,18 +205,18 @@ def test_variables_classes():
VariableEntry('WithSlots'),
CallEntry('def my_function():'),
LineEntry(),
- VariableEntry("(_d)['a']", '1'),
- VariableEntry("(_d)['b']", '2'),
VariableEntry('_d'),
+ VariableEntry("_d['a']", '1'),
+ VariableEntry("_d['b']", '2'),
LineEntry(),
- VariableEntry('(_s).x', '3'),
- VariableEntry('(_s).y', '4'),
VariableEntry('_s'),
+ VariableEntry('_s.x', '3'),
+ VariableEntry('_s.y', '4'),
LineEntry(),
- VariableEntry('(_lst)[997]', '997'),
- VariableEntry('(_lst)[998]', '998'),
- VariableEntry('(_lst)[999]', '999'),
VariableEntry('_lst'),
+ VariableEntry('_lst[997]', '997'),
+ VariableEntry('_lst[998]', '998'),
+ VariableEntry('_lst[999]', '999'),
ReturnEntry(),
ReturnValueEntry('None')
)
@@ -613,3 +616,19 @@ def test_error_in_overwrite_argument():
y = 8
return y + x
+
+def test_needs_parentheses():
+ assert not needs_parentheses('x')
+ assert not needs_parentheses('x.y')
+ assert not needs_parentheses('x.y.z')
+ assert not needs_parentheses('x.y.z[0]')
+ assert not needs_parentheses('x.y.z[0]()')
+ assert not needs_parentheses('x.y.z[0]()(3, 4 * 5)')
+ assert not needs_parentheses('foo(x)')
+ assert not needs_parentheses('foo(x+y)')
+ assert not needs_parentheses('(x+y)')
+ assert not needs_parentheses('[x+1 for x in ()]')
+ assert needs_parentheses('x + y')
+ assert needs_parentheses('x * y')
+ assert needs_parentheses('x and y')
+ assert needs_parentheses('x if z else y')
| Suggestion: "pydoc pysnooper" should show how to use this | 0.0 | 53b3ea13b8ecf52da80daf952a7df02d531a95a8 | [
"tests/test_pysnooper.py::test_string_io",
"tests/test_pysnooper.py::test_callable",
"tests/test_pysnooper.py::test_watch",
"tests/test_pysnooper.py::test_watch_explode",
"tests/test_pysnooper.py::test_variables_classes",
"tests/test_pysnooper.py::test_single_watch_no_comma",
"tests/test_pysnooper.py::test_long_variable",
"tests/test_pysnooper.py::test_repr_exception",
"tests/test_pysnooper.py::test_depth",
"tests/test_pysnooper.py::test_method_and_prefix",
"tests/test_pysnooper.py::test_file_output",
"tests/test_pysnooper.py::test_confusing_decorator_lines",
"tests/test_pysnooper.py::test_lambda",
"tests/test_pysnooper.py::test_unavailable_source",
"tests/test_pysnooper.py::test_no_overwrite_by_default",
"tests/test_pysnooper.py::test_overwrite",
"tests/test_pysnooper.py::test_error_in_overwrite_argument",
"tests/test_pysnooper.py::test_needs_parentheses"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2019-05-03 19:23:36+00:00 | mit | 1,687 |
|
corelight__pycommunityid-4 | diff --git a/README.md b/README.md
index 2613ecc..241bfee 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ This package provides a Python implementation of the open
[Community ID](https://github.com/corelight/community-id-spec)
flow hashing standard.
-It supports Python versions 2.7+ and 3+.
+It supports Python versions 2.7+ (for not much longer) and 3+.

diff --git a/communityid/algo.py b/communityid/algo.py
index 2b38e35..0876e05 100644
--- a/communityid/algo.py
+++ b/communityid/algo.py
@@ -57,9 +57,10 @@ class FlowTuple:
representations.
The sport and dport arguments are numeric port numbers, either
- provided as ints or in packed 16-bit network byte order. When
- the protocol number is one of PORT_PROTOS (TCP, UDP, etc),
- they are required. For other IP protocols they are optional.
+ provided as ints or in packed 16-bit network byte order, of
+ type "bytes". When the protocol number is one of PORT_PROTOS
+ (TCP, UDP, etc), they are required. For other IP protocols
+ they are optional.
The optional Boolean is_one_way argument indicates whether the
tuple captures a bidirectional flow (the default) or
@@ -245,17 +246,15 @@ class FlowTuple:
@staticmethod
def is_port(val):
- try:
- port = int(val)
- return 0 <= port <= 65535
- except ValueError:
- pass
+ if isinstance(val, bytes):
+ try:
+ port = struct.unpack('!H', val)[0]
+ return 0 <= port <= 65535
+ except (struct.error, IndexError, TypeError):
+ pass
- try:
- port = struct.unpack('!H', val)[0]
- return 0 <= port <= 65535
- except (struct.error, IndexError, TypeError):
- pass
+ if isinstance(val, int):
+ return 0 <= val <= 65535
return False
diff --git a/scripts/community-id b/scripts/community-id
index 3f3cf54..43d1104 100755
--- a/scripts/community-id
+++ b/scripts/community-id
@@ -39,10 +39,14 @@ class DefaultParser(TupleParser):
sport, dport = None, None
if num_parts == 5:
- if (not communityid.FlowTuple.is_port(parts[3]) or
- not communityid.FlowTuple.is_port(parts[4])):
+ try:
+ sport, dport = int(parts[3]), int(parts[4])
+ except ValueError:
+ return None, 'Could not parse port numbers'
+
+ if (not communityid.FlowTuple.is_port(sport) or
+ not communityid.FlowTuple.is_port(dport)):
return None, 'Could not parse port numbers'
- sport, dport = int(parts[3]), int(parts[4])
try:
return communityid.FlowTuple(
@@ -65,15 +69,20 @@ class ZeekLogsParser(TupleParser):
if proto is None:
return None, 'Could not parse IP protocol number'
+ try:
+ sport, dport = int(parts[1]), int(parts[3])
+ except ValueError:
+ return None, 'Could not parse port numbers'
+
if not (communityid.FlowTuple.is_ipaddr(parts[0]) and
- communityid.FlowTuple.is_port(parts[1]) and
+ communityid.FlowTuple.is_port(sport) and
communityid.FlowTuple.is_ipaddr(parts[2]) and
- communityid.FlowTuple.is_port(parts[3])):
+ communityid.FlowTuple.is_port(dport)):
return None, 'Need two IP addresses and port numbers'
try:
- return communityid.FlowTuple(proto, parts[0], parts[2],
- int(parts[1]), int(parts[3])), None
+ return communityid.FlowTuple(
+ proto, parts[0], parts[2], sport, dport), None
except communityid.FlowTupleError as err:
return None, repr(err)
| corelight/pycommunityid | 9f42930aa24fb3047bf9862cfac7ccdecea7dccd | diff --git a/tests/communityid_test.py b/tests/communityid_test.py
index 3655d56..f7bddee 100755
--- a/tests/communityid_test.py
+++ b/tests/communityid_test.py
@@ -231,6 +231,12 @@ class TestCommunityID(unittest.TestCase):
'1:LQU9qZlK+B5F3KDmev6m5PMibrg=',
'1:2d053da9994af81e45dca0e67afea6e4f3226eb8',
'1:3V71V58M3Ksw/yuFALMcW0LAHvc='],
+
+ # Verify https://github.com/corelight/pycommunityid/issues/3
+ ['10.0.0.1', '10.0.0.2', 10, 11569,
+ '1:SXBGMX1lBOwhhoDrZynfROxnhnM=',
+ '1:497046317d6504ec218680eb6729df44ec678673',
+ '1:HmBRGR+fUyXF4t8WEtal7Y0gEAo='],
],
communityid.FlowTuple.make_tcp,
communityid.PROTO_TCP,
@@ -310,6 +316,14 @@ class TestCommunityID(unittest.TestCase):
tpl = communityid.FlowTuple(
communityid.PROTO_TCP, '1.2.3.4', '5.6.7.8')
+ @unittest.skipIf(sys.version_info[0] < 3, 'not supported in Python 2.x')
+ def test_inputs_py3(self):
+ # Python 3 allows us to distinguish strings and byte sequences,
+ # and the following test only applies to it.
+ with self.assertRaises(communityid.FlowTupleError):
+ tpl = communityid.FlowTuple(
+ communityid.PROTO_TCP, '1.2.3.4', '5.6.7.8', 23, "80")
+
def test_get_proto(self):
self.assertEqual(communityid.get_proto(23), 23)
self.assertEqual(communityid.get_proto("23"), 23)
| FlowTupleError port invalid for specific ports
Hi, I started to experiment with community ID and pycommunityid and I think that I found a bug in function in_nbo():
https://github.com/corelight/pycommunityid/blob/b4467350446dde632eef59004a6b4e49cc55a85f/communityid/algo.py#L194-L213
- The problem is with the creation of the new FlowTuple at the end of function,
- exception will occur if sport or dport is from range 11569 - 11577:
`communityid.error.FlowTupleError: Destination port "b'-1'" invalid`
You can test it with your sample application:
`$ community-id tcp 10.0.0.1 10.0.0.2 10 11569`
Number 11569 in hex is 0x2D31 and that is '-1' in ASCII. I think the problem is with this line in function is_port(val):
https://github.com/corelight/pycommunityid/blob/b4467350446dde632eef59004a6b4e49cc55a85f/communityid/algo.py#L249
- bytes value of number 11569 is decoded as -1 and that is wrong
- I think other big port numbers can be problematic because they can be represented as ASCII characters too
- port with number 14392 is 0x3838 in hex and 88 in ASCII
I hope somebody will check this bug and will found a solution.
| 0.0 | 9f42930aa24fb3047bf9862cfac7ccdecea7dccd | [
"tests/communityid_test.py::TestCommunityID::test_inputs_py3",
"tests/communityid_test.py::TestCommunityID::test_tcp"
]
| [
"tests/communityid_test.py::TestCommunityID::test_get_proto",
"tests/communityid_test.py::TestCommunityID::test_icmp",
"tests/communityid_test.py::TestCommunityID::test_icmp6",
"tests/communityid_test.py::TestCommunityID::test_inputs",
"tests/communityid_test.py::TestCommunityID::test_ip",
"tests/communityid_test.py::TestCommunityID::test_sctp",
"tests/communityid_test.py::TestCommunityID::test_udp",
"tests/communityid_test.py::TestCommands::test_communityid",
"tests/communityid_test.py::TestCommands::test_communityid_tcpdump"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2021-03-05 21:53:57+00:00 | bsd-3-clause | 1,688 |
|
corteva__rioxarray-14 | diff --git a/rioxarray/exceptions.py b/rioxarray/exceptions.py
index 723a391..99a58fd 100644
--- a/rioxarray/exceptions.py
+++ b/rioxarray/exceptions.py
@@ -26,3 +26,7 @@ class TooManyDimensions(RioXarrayError):
class InvalidDimensionOrder(RioXarrayError):
"""This is raised when there the dimensions are not ordered correctly."""
+
+
+class MissingCRS(RioXarrayError):
+ """Missing the CRS in the dataset."""
diff --git a/rioxarray/rioxarray.py b/rioxarray/rioxarray.py
index acefb4b..1a9b0ec 100644
--- a/rioxarray/rioxarray.py
+++ b/rioxarray/rioxarray.py
@@ -25,6 +25,7 @@ from scipy.interpolate import griddata
from rioxarray.exceptions import (
InvalidDimensionOrder,
+ MissingCRS,
NoDataInBounds,
OneDimensionalRaster,
TooManyDimensions,
@@ -32,7 +33,7 @@ from rioxarray.exceptions import (
from rioxarray.crs import crs_to_wkt
FILL_VALUE_NAMES = ("_FillValue", "missing_value", "fill_value", "nodata")
-UNWANTED_RIO_ATTRS = ("nodata", "nodatavals", "crs", "is_tiled", "res")
+UNWANTED_RIO_ATTRS = ("nodatavals", "crs", "is_tiled", "res")
DEFAULT_GRID_MAP = "spatial_ref"
@@ -123,23 +124,9 @@ def add_xy_grid_meta(coords):
def add_spatial_ref(in_ds, dst_crs, grid_map_name):
- # remove old grid map if exists
- try:
- del in_ds.coords[grid_map_name]
- except KeyError:
- pass
-
- # add grid mapping variable
- in_ds.coords[grid_map_name] = xarray.Variable((), 0)
- match_proj = crs_to_wkt(CRS.from_user_input(dst_crs))
-
- grid_map_attrs = dict()
- # add grid mapping variable
- grid_map_attrs["spatial_ref"] = match_proj
- # http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html#appendix-grid-mappings
- # http://desktop.arcgis.com/en/arcmap/10.3/manage-data/netcdf/spatial-reference-for-netcdf-data.htm
- grid_map_attrs["crs_wkt"] = match_proj
- in_ds.coords[grid_map_name].attrs = grid_map_attrs
+ in_ds.rio.write_crs(
+ input_crs=dst_crs, grid_mapping_name=grid_map_name, inplace=True
+ )
return in_ds
@@ -230,7 +217,93 @@ class XRasterBase(object):
""":obj:`rasterio.crs.CRS`:
The projection of the dataset.
"""
- return self._crs
+ raise NotImplementedError
+
+ def set_crs(self, input_crs, inplace=True):
+ """
+ Set the CRS value for the Dataset/DataArray without modifying
+ the dataset/data array.
+
+ Parameters:
+ -----------
+ input_crs: object
+ Anythong accepted by `rasterio.crs.CRS.from_user_input`.
+
+ Returns:
+ --------
+ xarray.Dataset or xarray.DataArray:
+ Dataset with crs attribute.
+
+ """
+ crs = CRS.from_user_input(input_crs)
+ if inplace:
+ self._crs = crs
+ return self._obj
+ xobj = self._obj.copy(deep=True)
+ xobj.rio._crs = crs
+ return xobj
+
+ def write_crs(
+ self, input_crs=None, grid_mapping_name=DEFAULT_GRID_MAP, inplace=False
+ ):
+ """
+ Write the CRS to the dataset in a CF compliant manner.
+
+ Parameters:
+ -----------
+ input_crs: object
+ Anythong accepted by `rasterio.crs.CRS.from_user_input`.
+ grid_mapping_name: str, optional
+ Name of the coordinate to store the CRS information in.
+ inplace: bool, optional
+ If True, it will write to the existing dataset. Default is False.
+
+ Returns:
+ --------
+ xarray.Dataset or xarray.DataArray:
+ Modified dataset with CF compliant CRS information.
+
+ """
+ if input_crs is not None:
+ data_obj = self.set_crs(input_crs, inplace=inplace)
+ elif inplace:
+ data_obj = self._obj
+ else:
+ data_obj = self._obj.copy(deep=True)
+
+ # remove old grid maping coordinate if exists
+ try:
+ del data_obj.coords[grid_mapping_name]
+ except KeyError:
+ pass
+
+ if data_obj.rio.crs is None:
+ raise MissingCRS("CRS not found. Please set the CRS with 'set_crs()'.")
+ # add grid mapping coordinate
+ data_obj.coords[grid_mapping_name] = xarray.Variable((), 0)
+ crs_wkt = crs_to_wkt(data_obj.rio.crs)
+ grid_map_attrs = dict()
+ grid_map_attrs["spatial_ref"] = crs_wkt
+ # http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html#appendix-grid-mappings
+ # http://desktop.arcgis.com/en/arcmap/10.3/manage-data/netcdf/spatial-reference-for-netcdf-data.htm
+ grid_map_attrs["crs_wkt"] = crs_wkt
+ data_obj.coords[grid_mapping_name].attrs = grid_map_attrs
+
+ # add grid mapping attribute to variables
+ if hasattr(data_obj, "data_vars"):
+ for var in data_obj.data_vars:
+ if (
+ self.x_dim in data_obj[var].dims
+ and self.y_dim in data_obj[var].dims
+ ):
+ var_attrs = dict(data_obj[var].attrs)
+ var_attrs.update(grid_mapping=grid_mapping_name)
+ data_obj[var].attrs = var_attrs
+ else:
+ var_attrs = dict(data_obj.attrs)
+ var_attrs.update(grid_mapping=grid_mapping_name)
+ data_obj.attrs = var_attrs
+ return data_obj
@property
def shape(self):
@@ -255,17 +328,23 @@ class RasterArray(XRasterBase):
Retrieve projection from `xarray.DataArray`
"""
if self._crs is not None:
- return self._crs
+ return None if self._crs is False else self._crs
try:
# look in grid_mapping
grid_mapping_coord = self._obj.attrs["grid_mapping"]
- self._crs = CRS.from_user_input(
- self._obj.coords[grid_mapping_coord].attrs["spatial_ref"]
- )
+ try:
+ crs_wkt = self._obj.coords[grid_mapping_coord].attrs["spatial_ref"]
+ except KeyError:
+ crs_wkt = self._obj.coords[grid_mapping_coord].attrs["crs_wkt"]
+ self._crs = CRS.from_user_input(crs_wkt)
except KeyError:
- # look in attrs for 'crs' from rasterio xarray
- self._crs = CRS.from_user_input(self._obj.attrs["crs"])
+ try:
+ # look in attrs for 'crs' from rasterio xarray
+ self._crs = CRS.from_user_input(self._obj.attrs["crs"])
+ except KeyError:
+ self._crs = False
+ return None
return self._crs
@property
@@ -326,7 +405,7 @@ class RasterArray(XRasterBase):
left, bottom, right, top = self._int_bounds()
if width == 1 or height == 1:
- raise ValueError(
+ raise OneDimensionalRaster(
"Only 1 dimenional array found. Cannot calculate the resolution."
)
diff --git a/sphinx/history.rst b/sphinx/history.rst
index c2d61e7..b739537 100644
--- a/sphinx/history.rst
+++ b/sphinx/history.rst
@@ -6,6 +6,7 @@ History
- Find nodata and nodatavals in 'nodata' property (pull #12)
- Added 'encoded_nodata' property to DataArray (pull #12)
- Write the raster with encoded_nodata instead of NaN for nodata (pull #12)
+- Added methods to set and write CRS (issue #5)
0.0.4
------
| corteva/rioxarray | 2a516656ee2a8d345c3e9bdff1b5e8ee7adddf06 | diff --git a/test/integration/test_integration_rioxarray.py b/test/integration/test_integration_rioxarray.py
index 1708a01..8f3311c 100644
--- a/test/integration/test_integration_rioxarray.py
+++ b/test/integration/test_integration_rioxarray.py
@@ -7,7 +7,7 @@ import xarray
from numpy.testing import assert_almost_equal, assert_array_equal
from rasterio.crs import CRS
-from rioxarray.exceptions import NoDataInBounds, OneDimensionalRaster
+from rioxarray.exceptions import MissingCRS, NoDataInBounds, OneDimensionalRaster
from rioxarray.rioxarray import UNWANTED_RIO_ATTRS, _make_coords
from test.conftest import TEST_COMPARE_DATA_DIR, TEST_INPUT_DATA_DIR
@@ -508,9 +508,9 @@ def test_make_src_affine__single_point():
calculated_transform = tuple(xdi.rio.transform(recalc=True))
# delete the transform to ensure it is not being used
del xdi.attrs["transform"]
- with pytest.raises(ValueError):
+ with pytest.raises(OneDimensionalRaster):
xdi.rio.transform(recalc=True)
- with pytest.raises(ValueError):
+ with pytest.raises(OneDimensionalRaster):
xdi.rio.transform()
assert_array_equal(attribute_transform, attribute_transform_func)
@@ -726,3 +726,134 @@ def test_to_raster_3d(tmpdir):
assert_array_equal(rds.transform, xds.rio.transform())
assert_array_equal(rds.nodata, xds.rio.nodata)
assert_array_equal(rds.read(), xds.values)
+
+
+def test_missing_dimensions():
+ test_ds = xarray.Dataset()
+ with pytest.raises(KeyError):
+ test_ds.rio
+
+
+def test_crs_setter():
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("y", "x"),
+ coords={"y": numpy.arange(1, 6), "x": numpy.arange(2, 7)},
+ )
+ assert test_da.rio.crs is None
+ out_ds = test_da.rio.set_crs(4326)
+ assert test_da.rio.crs.to_epsg() == 4326
+ assert out_ds.rio.crs.to_epsg() == 4326
+ test_ds = test_da.to_dataset(name="test")
+ assert test_ds.rio.crs is None
+ out_ds = test_ds.rio.set_crs(4326)
+ assert test_ds.rio.crs.to_epsg() == 4326
+ assert out_ds.rio.crs.to_epsg() == 4326
+
+
+def test_crs_setter__copy():
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("y", "x"),
+ coords={"y": numpy.arange(1, 6), "x": numpy.arange(2, 7)},
+ )
+ assert test_da.rio.crs is None
+ out_ds = test_da.rio.set_crs(4326, inplace=False)
+ assert test_da.rio.crs is None
+ assert out_ds.rio.crs.to_epsg() == 4326
+ test_ds = test_da.to_dataset(name="test")
+ assert test_ds.rio.crs is None
+ out_ds = test_ds.rio.set_crs(4326, inplace=False)
+ assert test_ds.rio.crs is None
+ assert out_ds.rio.crs.to_epsg() == 4326
+
+
+def test_crs_writer__array__copy():
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("y", "x"),
+ coords={"y": numpy.arange(1, 6), "x": numpy.arange(2, 7)},
+ )
+ assert test_da.rio.crs is None
+ out_da = test_da.rio.write_crs(4326, grid_mapping_name="crs")
+ assert "crs_wkt" in out_da.coords["crs"].attrs
+ assert "spatial_ref" in out_da.coords["crs"].attrs
+ out_da.rio._crs = None
+ assert out_da.rio.crs.to_epsg() == 4326
+ test_da.rio._crs = None
+ assert test_da.rio.crs is None
+ assert "crs" not in test_da.coords
+ assert out_da.attrs["grid_mapping"] == "crs"
+
+
+def test_crs_writer__array__inplace():
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("y", "x"),
+ coords={"y": numpy.arange(1, 6), "x": numpy.arange(2, 7)},
+ )
+ assert test_da.rio.crs is None
+ out_da = test_da.rio.write_crs(4326, inplace=True)
+ assert "crs_wkt" in test_da.coords["spatial_ref"].attrs
+ assert "spatial_ref" in test_da.coords["spatial_ref"].attrs
+ assert out_da.coords["spatial_ref"] == test_da.coords["spatial_ref"]
+ test_da.rio._crs = None
+ assert test_da.rio.crs.to_epsg() == 4326
+ assert test_da.attrs["grid_mapping"] == "spatial_ref"
+ assert out_da.attrs == test_da.attrs
+ out_da.rio._crs = None
+ assert out_da.rio.crs.to_epsg() == 4326
+
+
+def test_crs_writer__dataset__copy():
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("y", "x"),
+ coords={"y": numpy.arange(1, 6), "x": numpy.arange(2, 7)},
+ )
+ test_da = test_da.to_dataset(name="test")
+ assert test_da.rio.crs is None
+ out_da = test_da.rio.write_crs(4326, grid_mapping_name="crs")
+ assert "crs_wkt" in out_da.coords["crs"].attrs
+ assert "spatial_ref" in out_da.coords["crs"].attrs
+ out_da.test.rio._crs = None
+ assert out_da.rio.crs.to_epsg() == 4326
+ assert out_da.test.attrs["grid_mapping"] == "crs"
+ # make sure input did not change the dataset
+ test_da.test.rio._crs = None
+ test_da.rio._crs = None
+ assert test_da.rio.crs is None
+ assert "crs" not in test_da.coords
+
+
+def test_crs_writer__dataset__inplace():
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("y", "x"),
+ coords={"y": numpy.arange(1, 6), "x": numpy.arange(2, 7)},
+ )
+ test_da = test_da.to_dataset(name="test")
+ assert test_da.rio.crs is None
+ out_da = test_da.rio.write_crs(4326, inplace=True)
+ assert "crs_wkt" in test_da.coords["spatial_ref"].attrs
+ assert "spatial_ref" in test_da.coords["spatial_ref"].attrs
+ assert out_da.coords["spatial_ref"] == test_da.coords["spatial_ref"]
+ out_da.test.rio._crs = None
+ assert out_da.rio.crs.to_epsg() == 4326
+ test_da.test.rio._crs = None
+ test_da.rio._crs = None
+ assert test_da.rio.crs.to_epsg() == 4326
+ assert out_da.test.attrs["grid_mapping"] == "spatial_ref"
+ assert out_da.test.attrs == test_da.test.attrs
+
+
+def test_crs_writer__missing():
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("y", "x"),
+ coords={"y": numpy.arange(1, 6), "x": numpy.arange(2, 7)},
+ )
+ with pytest.raises(MissingCRS):
+ test_da.rio.write_crs()
+ with pytest.raises(MissingCRS):
+ test_da.to_dataset(name="test").rio.write_crs()
| Add ability to set CRS and write CRS information to dataset
See: https://github.com/geoxarray/geoxarray/issues/9 | 0.0 | 2a516656ee2a8d345c3e9bdff1b5e8ee7adddf06 | [
"test/integration/test_integration_rioxarray.py::test_missing_dimensions",
"test/integration/test_integration_rioxarray.py::test_crs_setter",
"test/integration/test_integration_rioxarray.py::test_crs_setter__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__missing"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-06-27 15:15:43+00:00 | apache-2.0 | 1,689 |
|
corteva__rioxarray-28 | diff --git a/rioxarray/exceptions.py b/rioxarray/exceptions.py
index 99a58fd..c842097 100644
--- a/rioxarray/exceptions.py
+++ b/rioxarray/exceptions.py
@@ -12,21 +12,25 @@ class NoDataInBounds(RioXarrayError):
"""This is for when there are no data in the bounds for clipping a raster."""
-class OneDimensionalRaster(RioXarrayError):
- """This is an error when you have a 1 dimensional raster."""
-
-
class SingleVariableDataset(RioXarrayError):
"""This is for when you have a dataset with a single variable."""
-class TooManyDimensions(RioXarrayError):
+class DimensionError(RioXarrayError):
"""This is raised when there are more dimensions than is supported by the method"""
-class InvalidDimensionOrder(RioXarrayError):
+class TooManyDimensions(DimensionError):
+ """This is raised when there are more dimensions than is supported by the method"""
+
+
+class InvalidDimensionOrder(DimensionError):
"""This is raised when there the dimensions are not ordered correctly."""
+class OneDimensionalRaster(DimensionError):
+ """This is an error when you have a 1 dimensional raster."""
+
+
class MissingCRS(RioXarrayError):
"""Missing the CRS in the dataset."""
diff --git a/rioxarray/rioxarray.py b/rioxarray/rioxarray.py
index 1d791fc..3af3dae 100644
--- a/rioxarray/rioxarray.py
+++ b/rioxarray/rioxarray.py
@@ -24,6 +24,7 @@ from rasterio.features import geometry_mask
from scipy.interpolate import griddata
from rioxarray.exceptions import (
+ DimensionError,
InvalidDimensionOrder,
MissingCRS,
NoDataInBounds,
@@ -204,18 +205,19 @@ class XRasterBase(object):
def __init__(self, xarray_obj):
self._obj = xarray_obj
+ self._x_dim = None
+ self._y_dim = None
# Determine the spatial dimensions of the `xarray.DataArray`
if "x" in self._obj.dims and "y" in self._obj.dims:
- self.x_dim = "x"
- self.y_dim = "y"
+ self._x_dim = "x"
+ self._y_dim = "y"
elif "longitude" in self._obj.dims and "latitude" in self._obj.dims:
- self.x_dim = "longitude"
- self.y_dim = "latitude"
- else:
- raise KeyError("Missing x,y dimensions ...")
+ self._x_dim = "longitude"
+ self._y_dim = "latitude"
# properties
- self._shape = None
+ self._width = None
+ self._height = None
self._crs = None
@property
@@ -312,12 +314,80 @@ class XRasterBase(object):
data_obj.attrs = var_attrs
return data_obj
+ def set_spatial_dims(self, x_dim, y_dim, inplace=True):
+ """
+ This sets the spatial dimensions of the dataset.
+
+ Parameters:
+ -----------
+ x_dim: str
+ The name of the x dimension.
+ y_dim: str
+ The name of the y dimension.
+ inplace: bool, optional
+ If True, it will modify the dataframe in place.
+ Otherwise it will return a modified copy.
+
+ Returns:
+ --------
+ xarray.Dataset or xarray.DataArray:
+ Dataset with spatial dimensions set.
+
+ """
+
+ def set_dims(obj, in_x_dim, in_y_dim):
+ if in_x_dim in obj.dims:
+ obj.rio._x_dim = x_dim
+ else:
+ raise DimensionError("x dimension not found: {}".format(x_dim))
+ if y_dim in obj.dims:
+ obj.rio._y_dim = y_dim
+ else:
+ raise DimensionError("y dimension not found: {}".format(y_dim))
+
+ if not inplace:
+ obj_copy = self._obj.copy()
+ set_dims(obj_copy, x_dim, y_dim)
+ return obj_copy
+ set_dims(self._obj, x_dim, y_dim)
+ return self._obj
+
+ @property
+ def x_dim(self):
+ if self._x_dim is not None:
+ return self._x_dim
+ raise DimensionError(
+ "x dimension not found. 'set_spatial_dims()' can address this."
+ )
+
+ @property
+ def y_dim(self):
+ if self._y_dim is not None:
+ return self._y_dim
+ raise DimensionError(
+ "x dimension not found. 'set_spatial_dims()' can address this."
+ )
+
+ @property
+ def width(self):
+ """int: Returns the width of the dataset (x dimension size)"""
+ if self._width is not None:
+ return self._width
+ self._width = self._obj[self.x_dim].size
+ return self._width
+
+ @property
+ def height(self):
+ """int: Returns the height of the dataset (y dimension size)"""
+ if self._height is not None:
+ return self._height
+ self._height = self._obj[self.y_dim].size
+ return self._height
+
@property
def shape(self):
- """tuple: Returns the shape (x_size, y_size)"""
- if self._shape is None:
- self._shape = self._obj[self.x_dim].size, self._obj[self.y_dim].size
- return self._shape
+ """tuple: Returns the shape (width, height)"""
+ return (self.width, self.height)
@xarray.register_dataarray_accessor("rio")
@@ -402,8 +472,7 @@ class RasterArray(XRasterBase):
transform attribute.
"""
- width, height = self.shape
- if not recalc or width == 1 or height == 1:
+ if not recalc or self.width == 1 or self.height == 1:
try:
# get resolution from xarray rasterio
data_transform = Affine(*self._obj.attrs["transform"][:6])
@@ -414,19 +483,19 @@ class RasterArray(XRasterBase):
recalc = True
if recalc:
- left, bottom, right, top = self._int_bounds()
+ left, bottom, right, top = self._internal_bounds()
- if width == 1 or height == 1:
+ if self.width == 1 or self.height == 1:
raise OneDimensionalRaster(
"Only 1 dimenional array found. Cannot calculate the resolution."
)
- resolution_x = (right - left) / (width - 1)
- resolution_y = (bottom - top) / (height - 1)
+ resolution_x = (right - left) / (self.width - 1)
+ resolution_y = (bottom - top) / (self.height - 1)
return resolution_x, resolution_y
- def _int_bounds(self):
+ def _internal_bounds(self):
"""Determine the internal bounds of the `xarray.DataArray`"""
left = float(self._obj[self.x_dim][0])
right = float(self._obj[self.x_dim][-1])
@@ -476,7 +545,7 @@ class RasterArray(XRasterBase):
left, bottom, right, top: float
Outermost coordinates.
"""
- left, bottom, right, top = self._int_bounds()
+ left, bottom, right, top = self._internal_bounds()
src_resolution_x, src_resolution_y = self.resolution(recalc=recalc)
left -= src_resolution_x / 2.0
right += src_resolution_x / 2.0
@@ -563,9 +632,6 @@ class RasterArray(XRasterBase):
:class:`xarray.DataArray`: A reprojected DataArray.
"""
- # TODO: Support lazy loading of data with dask imperative function
- src_data = np.copy(self._obj.load().data)
-
src_affine = self.transform()
if dst_affine_width_height is not None:
dst_affine, dst_width, dst_height = dst_affine_width_height
@@ -594,7 +660,7 @@ class RasterArray(XRasterBase):
self.nodata if self.nodata is not None else dst_nodata
)
rasterio.warp.reproject(
- source=src_data,
+ source=np.copy(self._obj.load().data),
destination=dst_data,
src_transform=src_affine,
src_crs=self.crs,
@@ -682,12 +748,13 @@ class RasterArray(XRasterBase):
DataArray: A sliced :class:`xarray.DataArray` object.
"""
- if self._obj.y[0] > self._obj.y[-1]:
+ left, bottom, right, top = self._internal_bounds()
+ if top > bottom:
y_slice = slice(maxy, miny)
else:
y_slice = slice(miny, maxy)
- if self._obj.x[0] > self._obj.x[-1]:
+ if left > right:
x_slice = slice(maxx, minx)
else:
x_slice = slice(minx, maxx)
@@ -718,9 +785,9 @@ class RasterArray(XRasterBase):
DataArray: A clipped :class:`xarray.DataArray` object.
"""
- if self._obj.coords["x"].size == 1 or self._obj.coords["y"].size == 1:
+ if self.width == 1 or self.height == 1:
raise OneDimensionalRaster(
- "At least one of the raster x,y coordinates" " has only one point."
+ "At least one of the raster x,y coordinates has only one point."
)
resolution_x, resolution_y = self.resolution()
@@ -732,10 +799,10 @@ class RasterArray(XRasterBase):
cl_array = self.slice_xy(clip_minx, clip_miny, clip_maxx, clip_maxy)
- if cl_array.coords["x"].size < 1 or cl_array.coords["y"].size < 1:
+ if cl_array.rio.width < 1 or cl_array.rio.height < 1:
raise NoDataInBounds("No data found in bounds.")
- if cl_array.coords["x"].size == 1 or cl_array.coords["y"].size == 1:
+ if cl_array.rio.width == 1 or cl_array.rio.height == 1:
if auto_expand and auto_expand < auto_expand_limit:
return self.clip_box(
clip_minx,
@@ -799,10 +866,9 @@ class RasterArray(XRasterBase):
for geometry in geometries
]
- width, height = self.shape
clip_mask_arr = geometry_mask(
geometries=geometries,
- out_shape=(int(height), int(width)),
+ out_shape=(int(self.height), int(self.width)),
transform=self.transform(),
invert=True,
all_touched=all_touched,
@@ -933,7 +999,6 @@ class RasterArray(XRasterBase):
are ignored.
"""
- width, height = self.shape
dtype = str(self._obj.dtype) if dtype is None else dtype
extra_dim = self._check_dimensions()
count = 1
@@ -969,8 +1034,8 @@ class RasterArray(XRasterBase):
raster_path,
"w",
driver=driver,
- height=int(height),
- width=int(width),
+ height=int(self.height),
+ width=int(self.width),
count=count,
dtype=dtype,
crs=self.crs,
diff --git a/sphinx/history.rst b/sphinx/history.rst
index 6c761b3..06ca300 100644
--- a/sphinx/history.rst
+++ b/sphinx/history.rst
@@ -9,6 +9,7 @@ History
- Preserve None nodata if opened with `xarray.open_rasterio` (issue #20)
- Added `drop` argument for `clip()` (issue #25)
- Fix order of `CRS` for reprojecting geometries in `clip()` (pull #24)
+- Added `set_spatial_dims()` method for datasets when dimensions not found (issue #27)
0.0.5
-----
| corteva/rioxarray | d292b6340ce3dcd8a1bb225f20225c40ce97a9c5 | diff --git a/test/integration/test_integration_rioxarray.py b/test/integration/test_integration_rioxarray.py
index 049b15a..f711adc 100644
--- a/test/integration/test_integration_rioxarray.py
+++ b/test/integration/test_integration_rioxarray.py
@@ -8,7 +8,12 @@ from affine import Affine
from numpy.testing import assert_almost_equal, assert_array_equal
from rasterio.crs import CRS
-from rioxarray.exceptions import MissingCRS, NoDataInBounds, OneDimensionalRaster
+from rioxarray.exceptions import (
+ DimensionError,
+ MissingCRS,
+ NoDataInBounds,
+ OneDimensionalRaster,
+)
from rioxarray.rioxarray import UNWANTED_RIO_ATTRS, _make_coords
from test.conftest import TEST_COMPARE_DATA_DIR, TEST_INPUT_DATA_DIR
@@ -796,10 +801,61 @@ def test_to_raster__preserve_profile__none_nodata(tmpdir):
assert rds.nodata is None
-def test_missing_dimensions():
+def test_missing_spatial_dimensions():
test_ds = xarray.Dataset()
- with pytest.raises(KeyError):
- test_ds.rio
+ with pytest.raises(DimensionError):
+ test_ds.rio.shape
+ with pytest.raises(DimensionError):
+ test_ds.rio.width
+ with pytest.raises(DimensionError):
+ test_ds.rio.height
+ test_da = xarray.DataArray(1)
+ with pytest.raises(DimensionError):
+ test_da.rio.shape
+ with pytest.raises(DimensionError):
+ test_da.rio.width
+ with pytest.raises(DimensionError):
+ test_da.rio.height
+
+
+def test_set_spatial_dims():
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("lat", "lon"),
+ coords={"lat": numpy.arange(1, 6), "lon": numpy.arange(2, 7)},
+ )
+ test_da_copy = test_da.rio.set_spatial_dims(x_dim="lon", y_dim="lat", inplace=False)
+ assert test_da_copy.rio.x_dim == "lon"
+ assert test_da_copy.rio.y_dim == "lat"
+ assert test_da_copy.rio.width == 5
+ assert test_da_copy.rio.height == 5
+ assert test_da_copy.rio.shape == (5, 5)
+ with pytest.raises(DimensionError):
+ test_da.rio.shape
+ with pytest.raises(DimensionError):
+ test_da.rio.width
+ with pytest.raises(DimensionError):
+ test_da.rio.height
+
+ test_da.rio.set_spatial_dims(x_dim="lon", y_dim="lat", inplace=True)
+ assert test_da.rio.x_dim == "lon"
+ assert test_da.rio.y_dim == "lat"
+ assert test_da.rio.width == 5
+ assert test_da.rio.height == 5
+ assert test_da.rio.shape == (5, 5)
+
+
+def test_set_spatial_dims__missing():
+ test_ds = xarray.Dataset()
+ with pytest.raises(DimensionError):
+ test_ds.rio.set_spatial_dims(x_dim="lon", y_dim="lat")
+ test_da = xarray.DataArray(
+ numpy.zeros((5, 5)),
+ dims=("lat", "lon"),
+ coords={"lat": numpy.arange(1, 6), "lon": numpy.arange(2, 7)},
+ )
+ with pytest.raises(DimensionError):
+ test_da.rio.set_spatial_dims(x_dim="long", y_dim="lati")
def test_crs_setter():
| Allow users to define the x.y coordinates (similar to `set_geometry` in geopandas)
Currently only x,y and latitude,longitude are supported. But, sometime people use `lat`& `lon` etc... See: https://gis.stackexchange.com/questions/328128/extracting-data-within-geometry-shape/328320#comment535454_328320
It would be useful to allow users to define it themselves. Either `set_geometry` or `set_xy`?
Also, this would mean that the check for x,y coordinates would have to be delayed until users use a function that needs it.
Current workaround:
```python
>>> import xarray
>>> xds = xarray.Dataset(coords={"lon": [1, 2], "lat": [3, 4]})
>>> xds
<xarray.Dataset>
Dimensions: (lat: 2, lon: 2)
Coordinates:
* lon (lon) int64 1 2
* lat (lat) int64 3 4
Data variables:
*empty*
>>> xds.rename({"lon": "longitude", "lat": "latitude"})
<xarray.Dataset>
Dimensions: (latitude: 2, longitude: 2)
Coordinates:
* longitude (longitude) int64 1 2
* latitude (latitude) int64 3 4
Data variables:
*empty*
``` | 0.0 | d292b6340ce3dcd8a1bb225f20225c40ce97a9c5 | [
"test/integration/test_integration_rioxarray.py::test_missing_spatial_dimensions",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims__missing",
"test/integration/test_integration_rioxarray.py::test_crs_setter",
"test/integration/test_integration_rioxarray.py::test_crs_setter__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__missing"
]
| []
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-07-11 21:19:38+00:00 | apache-2.0 | 1,690 |
|
corteva__rioxarray-307 | diff --git a/docs/history.rst b/docs/history.rst
index 2732124..5448ef8 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -12,6 +12,7 @@ Latest
- BUG: Return correct transform in `rio.transform` with non-rectilinear transform (discussions #280)
- BUG: Update to handle WindowError in rasterio 1.2.2 (issue #286)
- BUG: Don't generate x,y coords in `rio` methods if not previously there (pull #294)
+- BUG: Preserve original data type for writing to disk (issue #305)
0.3.2
-----
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index d4e664a..0f72ffb 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -812,6 +812,8 @@ def open_rasterio(
encoding = {}
if mask_and_scale and "_Unsigned" in attrs:
unsigned = variables.pop_to(attrs, encoding, "_Unsigned") == "true"
+ if masked:
+ encoding["dtype"] = str(riods.dtypes[0])
da_name = attrs.pop("NETCDF_VARNAME", default_name)
data = indexing.LazilyOuterIndexedArray(
diff --git a/rioxarray/raster_array.py b/rioxarray/raster_array.py
index ce9a0cd..eeda38f 100644
--- a/rioxarray/raster_array.py
+++ b/rioxarray/raster_array.py
@@ -882,7 +882,11 @@ class RasterArray(XRasterBase):
if driver is None and LooseVersion(rasterio.__version__) < LooseVersion("1.2"):
driver = "GTiff"
- dtype = str(self._obj.dtype) if dtype is None else dtype
+ dtype = (
+ self._obj.encoding.get("dtype", str(self._obj.dtype))
+ if dtype is None
+ else dtype
+ )
# get the output profile from the rasterio object
# if opened with xarray.open_rasterio()
try:
| corteva/rioxarray | f3e4423010c785e281234a1ecbcc8e35901d4562 | diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index 5444785..5bb6815 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -270,7 +270,11 @@ def test_open_rasterio_mask_chunk_clip():
assert np.isnan(xdi.values).sum() == 52119
test_encoding = dict(xdi.encoding)
assert test_encoding.pop("source").endswith("small_dem_3m_merged.tif")
- assert test_encoding == {"_FillValue": 0.0, "grid_mapping": "spatial_ref"}
+ assert test_encoding == {
+ "_FillValue": 0.0,
+ "grid_mapping": "spatial_ref",
+ "dtype": "uint16",
+ }
attrs = dict(xdi.attrs)
assert_almost_equal(
tuple(xdi.rio._cached_transform())[:6],
@@ -307,7 +311,11 @@ def test_open_rasterio_mask_chunk_clip():
_assert_xarrays_equal(clipped, comp_subset)
test_encoding = dict(clipped.encoding)
assert test_encoding.pop("source").endswith("small_dem_3m_merged.tif")
- assert test_encoding == {"_FillValue": 0.0, "grid_mapping": "spatial_ref"}
+ assert test_encoding == {
+ "_FillValue": 0.0,
+ "grid_mapping": "spatial_ref",
+ "dtype": "uint16",
+ }
# test dataset
clipped_ds = xdi.to_dataset(name="test_data").rio.clip(
@@ -317,7 +325,11 @@ def test_open_rasterio_mask_chunk_clip():
_assert_xarrays_equal(clipped_ds, comp_subset_ds)
test_encoding = dict(clipped.encoding)
assert test_encoding.pop("source").endswith("small_dem_3m_merged.tif")
- assert test_encoding == {"_FillValue": 0.0, "grid_mapping": "spatial_ref"}
+ assert test_encoding == {
+ "_FillValue": 0.0,
+ "grid_mapping": "spatial_ref",
+ "dtype": "uint16",
+ }
##############################################################################
@@ -882,6 +894,7 @@ def test_mask_and_scale(open_rasterio):
"_FillValue": 32767.0,
"missing_value": 32767,
"grid_mapping": "crs",
+ "dtype": "uint16",
}
attrs = rds.air_temperature.attrs
assert attrs == {
@@ -912,6 +925,7 @@ def test_no_mask_and_scale(open_rasterio):
"_FillValue": 32767.0,
"missing_value": 32767,
"grid_mapping": "crs",
+ "dtype": "uint16",
}
attrs = rds.air_temperature.attrs
assert attrs == {
diff --git a/test/integration/test_integration_rioxarray.py b/test/integration/test_integration_rioxarray.py
index ed4ae54..ebe6a73 100644
--- a/test/integration/test_integration_rioxarray.py
+++ b/test/integration/test_integration_rioxarray.py
@@ -1160,6 +1160,7 @@ def test_to_raster(
assert_array_equal(rds.read(1), xds.fillna(xds.rio.encoded_nodata).values)
assert rds.count == 1
assert rds.tags() == {"AREA_OR_POINT": "Area", **test_tags, **xds_attrs}
+ assert rds.dtypes == ("int16",)
@pytest.mark.parametrize(
| Keep in memory original data type for writing
It could be very nice to keep in memory the original data type (ie. `uint16` for landsat data or `uint8` for classified data).
Indeed, for now (unless I missed something), if we open a dataset with `masked=True` and the data is casted to float, we lose the information of the original datatype.
So we always write the dataset on disk in float, even when it is not justified (when the nodata is replaced by its true value) | 0.0 | f3e4423010c785e281234a1ecbcc8e35901d4562 | [
"test/integration/test_integration__io.py::test_open_rasterio_mask_chunk_clip",
"test/integration/test_integration_rioxarray.py::test_to_raster[None-False-True-True-open_method1]",
"test/integration/test_integration_rioxarray.py::test_to_raster[None-False-True-True-open_method2]",
"test/integration/test_integration_rioxarray.py::test_to_raster[None-False-True-True-open_method3]",
"test/integration/test_integration_rioxarray.py::test_to_raster[None-False-True-True-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_to_raster[None-False-False-False-open_method1]",
"test/integration/test_integration_rioxarray.py::test_to_raster[None-False-False-False-open_method2]",
"test/integration/test_integration_rioxarray.py::test_to_raster[None-False-False-False-open_method3]",
"test/integration/test_integration_rioxarray.py::test_to_raster[None-False-False-False-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock1-False-True-True-open_method1]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock1-False-True-True-open_method2]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock1-False-True-True-open_method3]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock1-False-True-True-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock1-False-False-False-open_method1]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock1-False-False-False-open_method2]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock1-False-False-False-open_method3]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock1-False-False-False-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock2-True-True-True-open_method1]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock2-True-True-True-open_method2]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock2-True-True-True-open_method3]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock2-True-True-True-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock2-True-False-False-open_method1]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock2-True-False-False-open_method2]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock2-True-False-False-open_method3]",
"test/integration/test_integration_rioxarray.py::test_to_raster[write_lock2-True-False-False-open_rasterio_engine]"
]
| [
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-green-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue1-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:1blue-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable5-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-group6-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable7-group7-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-None-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-/PRODUCT-True]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_serialization",
"test/integration/test_integration__io.py::test_utm",
"test/integration/test_integration__io.py::test_notransform",
"test/integration/test_integration__io.py::test_indexing",
"test/integration/test_integration__io.py::test_caching",
"test/integration/test_integration__io.py::test_chunks",
"test/integration/test_integration__io.py::test_pickle_rasterio",
"test/integration/test_integration__io.py::test_no_mftime",
"test/integration/test_integration__io.py::test_rasterio_environment",
"test/integration/test_integration__io.py::test_rasterio_vrt",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_transform_and_size",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_src_crs",
"test/integration/test_integration__io.py::test_open_cog",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_pad_box[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func1-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func1-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func2-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func2-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio_engine-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio_engine-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func4-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func4-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func5-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func5-False]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_func3]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_func5]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_reproject__scalar_coord[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_reproject__scalar_coord[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_missing_spatial_dimensions",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims__missing",
"test/integration/test_integration_rioxarray.py::test_crs_empty_dataset",
"test/integration/test_integration_rioxarray.py::test_crs_setter",
"test/integration/test_integration_rioxarray.py::test_crs_setter__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__missing",
"test/integration/test_integration_rioxarray.py::test_crs__dataset__different_crs",
"test/integration/test_integration_rioxarray.py::test_clip_missing_crs",
"test/integration/test_integration_rioxarray.py::test_reproject_missing_crs",
"test/integration/test_integration_rioxarray.py::test_reproject_resolution_and_shape_transform",
"test/integration/test_integration_rioxarray.py::test_reproject_transform_missing_shape",
"test/integration/test_integration_rioxarray.py::test_crs_get_custom",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset",
"test/integration/test_integration_rioxarray.py::test_write_crs_cf",
"test/integration/test_integration_rioxarray.py::test_write_crs_cf__disable_grid_mapping",
"test/integration/test_integration_rioxarray.py::test_write_crs__missing_geospatial_dims",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset__nonstandard_grid_mapping",
"test/integration/test_integration_rioxarray.py::test_nodata_setter",
"test/integration/test_integration_rioxarray.py::test_nodata_setter__copy",
"test/integration/test_integration_rioxarray.py::test_nodata_writer__array__copy",
"test/integration/test_integration_rioxarray.py::test_nodata_writer__array__inplace",
"test/integration/test_integration_rioxarray.py::test_nodata_writer__missing",
"test/integration/test_integration_rioxarray.py::test_nodata_writer__remove",
"test/integration/test_integration_rioxarray.py::test_nodata_writer__different_dtype[-1.1_0]",
"test/integration/test_integration_rioxarray.py::test_nodata_writer__different_dtype[-1.1_1]",
"test/integration/test_integration_rioxarray.py::test_isel_window",
"test/integration/test_integration_rioxarray.py::test_write_pyproj_crs_dataset",
"test/integration/test_integration_rioxarray.py::test_missing_transform_bounds",
"test/integration/test_integration_rioxarray.py::test_missing_transform_resolution",
"test/integration/test_integration_rioxarray.py::test_write_transform__from_read",
"test/integration/test_integration_rioxarray.py::test_write_transform",
"test/integration/test_integration_rioxarray.py::test_write_read_transform__non_rectilinear",
"test/integration/test_integration_rioxarray.py::test_write_read_transform__non_rectilinear__warning",
"test/integration/test_integration_rioxarray.py::test_missing_transform",
"test/integration/test_integration_rioxarray.py::test_grid_mapping_default",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs__missing_crs",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs__out_of_bounds",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_missing_nodata"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-04-20 13:51:18+00:00 | apache-2.0 | 1,691 |
|
corteva__rioxarray-319 | diff --git a/docs/history.rst b/docs/history.rst
index dd91a88..b9b0820 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -9,6 +9,7 @@ Latest
- ENH: enable `engine="rasterio"` via xarray backend API (issue #197 pull #281)
- ENH: Generate 2D coordinates for non-rectilinear sources (issue #290)
- ENH: Add `encoded` kwarg to `rio.write_nodata` (discussions #313)
+- ENH: Added `decode_times` and `decode_timedelta` kwargs to `rioxarray.open_rasterio` (issue #316)
- BUG: Use float32 for smaller dtypes when masking (discussions #302)
- BUG: Return correct transform in `rio.transform` with non-rectilinear transform (discussions #280)
- BUG: Update to handle WindowError in rasterio 1.2.2 (issue #286)
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index 0f72ffb..9812279 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -26,6 +26,7 @@ from xarray.core import indexing
from xarray.core.dataarray import DataArray
from xarray.core.dtypes import maybe_promote
from xarray.core.utils import is_scalar
+from xarray.core.variable import as_variable
from rioxarray.exceptions import RioXarrayError
from rioxarray.rioxarray import _generate_spatial_coords
@@ -452,60 +453,37 @@ def _get_rasterio_attrs(riods):
return attrs
-def _decode_datetime_cf(data_array):
+def _decode_datetime_cf(data_array, decode_times, decode_timedelta):
"""
Decide the datetime based on CF conventions
"""
+ if decode_timedelta is None:
+ decode_timedelta = decode_times
+
for coord in data_array.coords:
- # stage 1: timedelta
- if (
- "units" in data_array[coord].attrs
- and data_array[coord].attrs["units"] in times.TIME_UNITS
- ):
- units = times.pop_to(
- data_array[coord].attrs, data_array[coord].encoding, "units"
- )
- new_values = times.decode_cf_timedelta(
- data_array[coord].values, units=units
- )
- data_array = data_array.assign_coords(
- {
- coord: IndexVariable(
- dims=data_array[coord].dims,
- data=new_values.astype(np.dtype("timedelta64[ns]")),
- attrs=data_array[coord].attrs,
- encoding=data_array[coord].encoding,
- )
- }
+ time_var = None
+ if decode_times and "since" in data_array[coord].attrs.get("units", ""):
+ time_var = times.CFDatetimeCoder(use_cftime=True).decode(
+ as_variable(data_array[coord]), name=coord
)
-
- # stage 2: datetime
- if (
- "units" in data_array[coord].attrs
- and "since" in data_array[coord].attrs["units"]
+ elif (
+ decode_timedelta
+ and data_array[coord].attrs.get("units") in times.TIME_UNITS
):
- units = times.pop_to(
- data_array[coord].attrs, data_array[coord].encoding, "units"
- )
- calendar = times.pop_to(
- data_array[coord].attrs, data_array[coord].encoding, "calendar"
+ time_var = times.CFTimedeltaCoder().decode(
+ as_variable(data_array[coord]), name=coord
)
- dtype = times._decode_cf_datetime_dtype(
- data_array[coord].values, units, calendar, True
- )
- new_values = times.decode_cf_datetime(
- data_array[coord].values,
- units=units,
- calendar=calendar,
- use_cftime=True,
+ if time_var is not None:
+ dimensions, data, attributes, encoding = variables.unpack_for_decoding(
+ time_var
)
data_array = data_array.assign_coords(
{
coord: IndexVariable(
- dims=data_array[coord].dims,
- data=new_values.astype(dtype),
- attrs=data_array[coord].attrs,
- encoding=data_array[coord].encoding,
+ dims=dimensions,
+ data=data,
+ attrs=attributes,
+ encoding=encoding,
)
}
)
@@ -539,6 +517,9 @@ def _load_subdatasets(
lock,
masked,
mask_and_scale,
+ decode_times,
+ decode_timedelta,
+ **open_kwargs,
):
"""
Load in rasterio subdatasets
@@ -562,6 +543,9 @@ def _load_subdatasets(
masked=masked,
mask_and_scale=mask_and_scale,
default_name=subdataset.split(":")[-1].lstrip("/").replace("/", "_"),
+ decode_times=decode_times,
+ decode_timedelta=decode_timedelta,
+ **open_kwargs,
)
if shape not in dim_groups:
dim_groups[shape] = {rioda.name: rioda}
@@ -648,6 +632,8 @@ def open_rasterio(
variable=None,
group=None,
default_name=None,
+ decode_times=True,
+ decode_timedelta=None,
**open_kwargs,
):
# pylint: disable=too-many-statements,too-many-locals,too-many-branches
@@ -706,6 +692,14 @@ def open_rasterio(
Group name or names to use to filter loading.
default_name: str, optional
The name of the data array if none exists. Default is None.
+ decode_times: bool, optional
+ If True, decode times encoded in the standard NetCDF datetime format
+ into datetime objects. Otherwise, leave them encoded as numbers.
+ decode_timedelta: bool, optional
+ If True, decode variables and coordinates with time units in
+ {“days”, “hours”, “minutes”, “seconds”, “milliseconds”, “microseconds”}
+ into timedelta objects. If False, leave them encoded as numbers.
+ If None (default), assume the same value of decode_time.
**open_kwargs: kwargs, optional
Optional keyword arguments to pass into rasterio.open().
@@ -777,6 +771,9 @@ def open_rasterio(
lock=lock,
masked=masked,
mask_and_scale=mask_and_scale,
+ decode_times=decode_times,
+ decode_timedelta=decode_timedelta,
+ **open_kwargs,
)
if vrt_params is not None:
@@ -840,7 +837,9 @@ def open_rasterio(
# update attributes from NetCDF attributess
_load_netcdf_attrs(riods.tags(), result)
- result = _decode_datetime_cf(result)
+ result = _decode_datetime_cf(
+ result, decode_times=decode_times, decode_timedelta=decode_timedelta
+ )
# make sure the _FillValue is correct dtype
if "_FillValue" in attrs:
diff --git a/rioxarray/xarray_plugin.py b/rioxarray/xarray_plugin.py
index 449fbc9..87c27ea 100644
--- a/rioxarray/xarray_plugin.py
+++ b/rioxarray/xarray_plugin.py
@@ -41,6 +41,8 @@ class RasterioBackend(xr.backends.common.BackendEntrypoint):
variable=None,
group=None,
default_name="band_data",
+ decode_times=True,
+ decode_timedelta=None,
open_kwargs=None,
):
if open_kwargs is None:
@@ -56,6 +58,8 @@ class RasterioBackend(xr.backends.common.BackendEntrypoint):
variable=variable,
group=group,
default_name=default_name,
+ decode_times=decode_times,
+ decode_timedelta=decode_timedelta,
**open_kwargs,
)
if isinstance(ds, xr.DataArray):
| corteva/rioxarray | 9f92e893f390ac1ddf649432bcc36757248207a0 | diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index dbe7c21..19edf3e 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -981,6 +981,27 @@ def test_nc_attr_loading(open_rasterio):
assert str(rds.time.values[1]) == "2016-12-29 12:52:42.347451"
[email protected](
+ LooseVersion(rasterio.__gdal_version__) < LooseVersion("3.0.4"),
+ reason="This was fixed in GDAL 3.0.4",
+)
+def test_nc_attr_loading__disable_decode_times(open_rasterio):
+ with open_rasterio(
+ os.path.join(TEST_INPUT_DATA_DIR, "PLANET_SCOPE_3D.nc"), decode_times=False
+ ) as rds:
+ assert rds.dims == {"y": 10, "x": 10, "time": 2}
+ assert rds.attrs == {"coordinates": "spatial_ref"}
+ assert rds.y.attrs["units"] == "metre"
+ assert rds.x.attrs["units"] == "metre"
+ assert rds.time.encoding == {}
+ assert np.isnan(rds.time.attrs.pop("_FillValue"))
+ assert rds.time.attrs == {
+ "units": "seconds since 2016-12-19T10:27:29.687763",
+ "calendar": "proleptic_gregorian",
+ }
+ assert_array_equal(rds.time.values, [0, 872712.659688])
+
+
def test_lockless():
with rioxarray.open_rasterio(
os.path.join(TEST_INPUT_DATA_DIR, "PLANET_SCOPE_3D.nc"), lock=False, chunks=True
| open_rasterio fails on NetCDF files with non-standard time units
<!-- Please search existing issues to avoid creating duplicates. -->
#### Code Sample
NOTE: The dataset is available from the [LUH2 site](http://gsweb1vh2.umd.edu/LUH2/LUH2_v2f/MESSAGE/multiple-states_input4MIPs_landState_ScenarioMIP_UofMD-MESSAGE-ssp245-2-1-f_gn_2015-2100.nc).
```python
import rioxarray as rxr
rxr.open_rasterio('multiple-states_input4MIPs_landState_ScenarioMIP_UofMD-MESSAGE-ssp245-2-1-f_gn_2015-2100.nc')
```
#### Problem description
The [LUH2](https://luh.umd.edu) datasets have a non-standard time units (`years since 2015-01-01 0:0:0`) which causes `open_rasterio()` to fail with an exception. The error message suggest passing the flag `decode_times=False` or installing `cftime`. Neither approach solved the problem for me.
It would be great if **rioxarray** had the equivalent of `decode_times` for datasets like this one.
Caveat: I don't get an exception when opening the file remotely via http:// You will need to download the file and run it locally.
#### Expected Output
`open_rasterio()` succeeds.
#### Environment Information
```
rioxarray (0.3.1) deps:
rasterio: 1.2.2
xarray: 0.17.0
GDAL: 3.2.2
Other python deps:
scipy: 1.6.2
pyproj: 3.0.1
```
#### Installation method
- pypi
#### Packages
```
Package Version
----------------- ---------
affine 2.3.0
attrs 20.3.0
blosc 1.9.2
bokeh 2.3.1
certifi 2020.12.5
cftime 1.4.1
click 7.1.2
click-plugins 1.1.1
cligj 0.7.1
cloudpickle 1.6.0
cycler 0.10.0
dask 2021.4.0
distributed 2021.4.0
fsspec 2021.4.0
HeapDict 1.0.1
Jinja2 2.11.3
kiwisolver 1.3.1
locket 0.2.1
lz4 3.1.1
MarkupSafe 1.1.1
matplotlib 3.4.1
msgpack 1.0.0
netCDF4 1.5.6
numpy 1.18.1
packaging 20.9
pandas 1.2.4
partd 1.2.0
Pillow 8.2.0
pip 21.0.1
psutil 5.8.0
pyflakes 2.3.1
pyparsing 2.4.7
pyproj 3.0.1
python-dateutil 2.8.1
pytz 2021.1
PyYAML 5.4.1
rasterio 1.2.2
rioxarray 0.3.1
scipy 1.6.2
setuptools 56.0.0
six 1.15.0
snuggs 1.4.7
sortedcontainers 2.3.0
tblib 1.7.0
toolz 0.11.1
tornado 6.1
typing-extensions 3.7.4.3
wheel 0.36.2
xarray 0.17.0
zict 2.0.0
``` | 0.0 | 9f92e893f390ac1ddf649432bcc36757248207a0 | [
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio_engine]"
]
| [
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-green-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue1-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:1blue-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable5-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-group6-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable7-group7-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-None-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-/PRODUCT-True]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_rasterio_mask_chunk_clip",
"test/integration/test_integration__io.py::test_serialization",
"test/integration/test_integration__io.py::test_utm",
"test/integration/test_integration__io.py::test_notransform",
"test/integration/test_integration__io.py::test_indexing",
"test/integration/test_integration__io.py::test_caching",
"test/integration/test_integration__io.py::test_chunks",
"test/integration/test_integration__io.py::test_pickle_rasterio",
"test/integration/test_integration__io.py::test_no_mftime",
"test/integration/test_integration__io.py::test_rasterio_environment",
"test/integration/test_integration__io.py::test_rasterio_vrt",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_transform_and_size",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_src_crs",
"test/integration/test_integration__io.py::test_open_cog",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio_engine]"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2021-04-23 18:26:40+00:00 | apache-2.0 | 1,692 |
|
corteva__rioxarray-346 | diff --git a/.flake8 b/.flake8
index 06ffc9b..fdcf6e3 100644
--- a/.flake8
+++ b/.flake8
@@ -1,6 +1,7 @@
[flake8]
max_line_length = 88
ignore =
+ E501 # line too long - let black handle that
C408 # Unnecessary dict/list/tuple call - rewrite as a literal
E203 # whitespace before ':' - doesn't work well with black
E225 # missing whitespace around operator - let black worry about that
diff --git a/docs/history.rst b/docs/history.rst
index 217dc86..fcd17ec 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -4,6 +4,7 @@ History
Latest
------
- BUG: pass kwargs with lock=False (issue #344)
+- BUG: Close file handle with lock=False (pull #346)
0.4.0
------
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index aeda3b7..c243f38 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -9,6 +9,7 @@ Source file: https://github.com/pydata/xarray/blob/1d7bcbdc75b6d556c04e2c7d7a042
import contextlib
import os
import re
+import threading
import warnings
from distutils.version import LooseVersion
@@ -35,6 +36,63 @@ RASTERIO_LOCK = SerializableLock()
NO_LOCK = contextlib.nullcontext()
+class FileHandleLocal(threading.local):
+ """
+ This contains the thread local ThreadURIManager
+ """
+
+ def __init__(self): # pylint: disable=super-init-not-called
+ self.thread_manager = None # Initialises in each thread
+
+
+class ThreadURIManager:
+ """
+ This handles opening & closing file handles in each thread.
+ """
+
+ def __init__(
+ self,
+ opener,
+ *args,
+ mode="r",
+ kwargs=None,
+ ):
+ self._opener = opener
+ self._args = args
+ self._mode = mode
+ self._kwargs = {} if kwargs is None else dict(kwargs)
+ self._file_handle = None
+
+ @property
+ def file_handle(self):
+ """
+ File handle returned by the opener.
+ """
+ if self._file_handle is not None:
+ return self._file_handle
+ print("OPEN")
+ self._file_handle = self._opener(*self._args, mode=self._mode, **self._kwargs)
+ return self._file_handle
+
+ def close(self):
+ """
+ Close file handle.
+ """
+ if self._file_handle is not None:
+ print("CLOSE")
+ self._file_handle.close()
+ self._file_handle = None
+
+ def __del__(self):
+ self.close()
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type_, value, traceback):
+ self.close()
+
+
class URIManager(FileManager):
"""
The URI manager is used for lockless reading
@@ -51,15 +109,39 @@ class URIManager(FileManager):
self._args = args
self._mode = mode
self._kwargs = {} if kwargs is None else dict(kwargs)
+ self._local = FileHandleLocal()
def acquire(self, needs_lock=True):
- return self._opener(*self._args, mode=self._mode, **self._kwargs)
+ if self._local.thread_manager is None:
+ self._local.thread_manager = ThreadURIManager(
+ self._opener, *self._args, mode=self._mode, kwargs=self._kwargs
+ )
+ return self._local.thread_manager.file_handle
+ @contextlib.contextmanager
def acquire_context(self, needs_lock=True):
- yield self.acquire(needs_lock=needs_lock)
+ try:
+ yield self.acquire(needs_lock=needs_lock)
+ except Exception:
+ self.close(needs_lock=needs_lock)
+ raise
def close(self, needs_lock=True):
- pass
+ if self._local.thread_manager is not None:
+ self._local.thread_manager.close()
+ self._local.thread_manager = None
+
+ def __del__(self):
+ self.close(needs_lock=False)
+
+ def __getstate__(self):
+ """State for pickling."""
+ return (self._opener, self._args, self._mode, self._kwargs)
+
+ def __setstate__(self, state):
+ """Restore from a pickle."""
+ opener, args, mode, kwargs = state
+ self.__init__(opener, *args, mode=mode, kwargs=kwargs)
class RasterioArrayWrapper(BackendArray):
| corteva/rioxarray | b7d5999ce7ce4015a004a402d64cd29c6cbd056b | diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index d471375..339767a 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -1009,14 +1009,14 @@ def test_nc_attr_loading__disable_decode_times(open_rasterio):
def test_lockless():
with rioxarray.open_rasterio(
- os.path.join(TEST_INPUT_DATA_DIR, "PLANET_SCOPE_3D.nc"), lock=False, chunks=True
+ os.path.join(TEST_INPUT_DATA_DIR, "cog.tif"), lock=False, chunks=True
) as rds:
rds.mean().compute()
def test_lock_true():
with rioxarray.open_rasterio(
- os.path.join(TEST_INPUT_DATA_DIR, "PLANET_SCOPE_3D.nc"), lock=True, chunks=True
+ os.path.join(TEST_INPUT_DATA_DIR, "cog.tif"), lock=True, chunks=True
) as rds:
rds.mean().compute()
diff --git a/test/integration/test_integration__io_uri_manager.py b/test/integration/test_integration__io_uri_manager.py
new file mode 100644
index 0000000..e3251ae
--- /dev/null
+++ b/test/integration/test_integration__io_uri_manager.py
@@ -0,0 +1,139 @@
+"""
+Tests based on: https://github.com/pydata/xarray/blob/071da2a900702d65c47d265192bc7e424bb57932/xarray/tests/test_backends_file_manager.py
+"""
+import concurrent.futures
+import gc
+import pickle
+from unittest import mock
+
+import pytest
+
+from rioxarray._io import URIManager
+
+
+def test_uri_manager_mock_write():
+ mock_file = mock.Mock()
+ opener = mock.Mock(spec=open, return_value=mock_file)
+
+ manager = URIManager(opener, "filename")
+ f = manager.acquire()
+ f.write("contents")
+ manager.close()
+
+ opener.assert_called_once_with("filename", mode="r")
+ mock_file.write.assert_called_once_with("contents")
+ mock_file.close.assert_called_once_with()
+
+
+def test_uri_manager_mock_write__threaded():
+ mock_file = mock.Mock()
+ opener = mock.Mock(spec=open, return_value=mock_file)
+
+ manager = URIManager(opener, "filename")
+
+ def write(iter):
+ nonlocal manager
+ fh = manager.acquire()
+ fh.write("contents")
+ manager._local.thread_manager = None
+
+ with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
+ for result in executor.map(write, range(5)):
+ pass
+
+ gc.collect()
+
+ opener.assert_has_calls([mock.call("filename", mode="r") for _ in range(5)])
+ mock_file.write.assert_has_calls([mock.call("contents") for _ in range(5)])
+ mock_file.close.assert_has_calls([mock.call() for _ in range(5)])
+
+
[email protected]("expected_warning", [None, RuntimeWarning])
+def test_uri_manager_autoclose(expected_warning):
+ mock_file = mock.Mock()
+ opener = mock.Mock(return_value=mock_file)
+
+ manager = URIManager(opener, "filename")
+ manager.acquire()
+
+ del manager
+ gc.collect()
+
+ mock_file.close.assert_called_once_with()
+
+
+def test_uri_manager_write_concurrent(tmpdir):
+ path = str(tmpdir.join("testing.txt"))
+ manager = URIManager(open, path, mode="w")
+ f1 = manager.acquire()
+ f2 = manager.acquire()
+ f3 = manager.acquire()
+ assert f1 is f2
+ assert f2 is f3
+ f1.write("foo")
+ f1.flush()
+ f2.write("bar")
+ f2.flush()
+ f3.write("baz")
+ f3.flush()
+
+ del manager
+ gc.collect()
+
+ with open(path) as f:
+ assert f.read() == "foobarbaz"
+
+
+def test_uri_manager_write_pickle(tmpdir):
+ path = str(tmpdir.join("testing.txt"))
+ manager = URIManager(open, path, mode="a")
+ f = manager.acquire()
+ f.write("foo")
+ f.flush()
+ manager2 = pickle.loads(pickle.dumps(manager))
+ f2 = manager2.acquire()
+ f2.write("bar")
+ del manager
+ del manager2
+ gc.collect()
+
+ with open(path) as f:
+ assert f.read() == "foobar"
+
+
+def test_uri_manager_read(tmpdir):
+ path = str(tmpdir.join("testing.txt"))
+
+ with open(path, "w") as f:
+ f.write("foobar")
+
+ manager = URIManager(open, path)
+ f = manager.acquire()
+ assert f.read() == "foobar"
+ manager.close()
+
+
+def test_uri_manager_acquire_context(tmpdir):
+ path = str(tmpdir.join("testing.txt"))
+
+ with open(path, "w") as f:
+ f.write("foobar")
+
+ class AcquisitionError(Exception):
+ pass
+
+ manager = URIManager(open, path)
+ with pytest.raises(AcquisitionError):
+ with manager.acquire_context() as f:
+ assert f.read() == "foobar"
+ raise AcquisitionError
+
+ with manager.acquire_context() as f:
+ assert f.read() == "foobar"
+
+ with pytest.raises(AcquisitionError):
+ with manager.acquire_context() as f:
+ f.seek(0)
+ assert f.read() == "foobar"
+ raise AcquisitionError
+ manager.close()
| overview not read when specifying chunks or lock
#### Code Sample, a copy-pastable example if possible
```python
import rasterio
import rioxarray
# from https://openaerialmap.org/
cog_url = (
"https://oin-hotosm.s3.amazonaws.com/"
"5d7dad0becaf880008a9bc88/0/5d7dad0becaf880008a9bc89.tif"
)
```
```python
ds = rioxarray.open_rasterio(cog_url, lock=False, chunks=(4, "auto", -1))
ds.shape
```
(3, 9984, 22016)
```python
dsLockChunksOverview = rioxarray.open_rasterio(cog_url, lock=False, chunks=(4, "auto", -1), overview_level=1)
dsLockChunksOverview.shape
```
(3, 9984, 22016)
```python
dsChunksOverview = rioxarray.open_rasterio(cog_url, chunks=(4, "auto", -1), overview_level=1)
dsChunksOverview.shape
```
(3, 9984, 22016)
```python
dsLockOverview = rioxarray.open_rasterio(cog_url, lock=False, overview_level=1)
dsLockOverview.shape
```
(3, 9984, 22016)
```python
dsOverview = rioxarray.open_rasterio(cog_url, overview_level=1)
dsOverview.shape
```
(3, 2496, 5504)
#### Problem description
Large COGs consequently have large overviews. It may be beneficial to read the overview in parallel without locks, as documented in [Reading COGs in Parallel](https://corteva.github.io/rioxarray/stable/examples/read-locks.html). Perhaps this behavior is documented, but I could not find it.
#### Expected Output
The correct shape of the overview `(3, 2496, 5504)` when specifying `overview_level` AND `chunks` or `lock`.
#### Environment Information
rioxarray (0.4.0) deps:
rasterio: 1.2.3
xarray: 0.18.2
GDAL: 3.2.2
Other python deps:
scipy: 1.6.3
pyproj: 3.0.1
System:
python: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
executable: /usr/bin/python3
machine: Linux-5.4.104+-x86_64-with-debian-10.9
#### Installation method
pypi | 0.0 | b7d5999ce7ce4015a004a402d64cd29c6cbd056b | [
"test/integration/test_integration__io_uri_manager.py::test_uri_manager_mock_write",
"test/integration/test_integration__io_uri_manager.py::test_uri_manager_mock_write__threaded",
"test/integration/test_integration__io_uri_manager.py::test_uri_manager_autoclose[None]",
"test/integration/test_integration__io_uri_manager.py::test_uri_manager_autoclose[RuntimeWarning]",
"test/integration/test_integration__io_uri_manager.py::test_uri_manager_write_concurrent",
"test/integration/test_integration__io_uri_manager.py::test_uri_manager_write_pickle",
"test/integration/test_integration__io_uri_manager.py::test_uri_manager_acquire_context"
]
| [
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-green-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue1-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:1blue-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable5-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-group6-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable7-group7-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-None-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-/PRODUCT-True]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_rasterio_mask_chunk_clip",
"test/integration/test_integration__io.py::test_serialization",
"test/integration/test_integration__io.py::test_utm",
"test/integration/test_integration__io.py::test_notransform",
"test/integration/test_integration__io.py::test_indexing",
"test/integration/test_integration__io.py::test_caching",
"test/integration/test_integration__io.py::test_chunks",
"test/integration/test_integration__io.py::test_pickle_rasterio",
"test/integration/test_integration__io.py::test_no_mftime",
"test/integration/test_integration__io.py::test_rasterio_environment",
"test/integration/test_integration__io.py::test_rasterio_vrt",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_transform_and_size",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_src_crs",
"test/integration/test_integration__io.py::test_open_cog[True]",
"test/integration/test_integration__io.py::test_open_cog[False]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_lockless",
"test/integration/test_integration__io.py::test_lock_true",
"test/integration/test_integration__io.py::test_non_rectilinear",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio_engine]",
"test/integration/test_integration__io_uri_manager.py::test_uri_manager_read"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2021-05-24 14:14:36+00:00 | apache-2.0 | 1,693 |
|
corteva__rioxarray-347 | diff --git a/docs/history.rst b/docs/history.rst
index 85e3950..217dc86 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -3,7 +3,7 @@ History
Latest
------
-
+- BUG: pass kwargs with lock=False (issue #344)
0.4.0
------
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index 0924175..aeda3b7 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -53,7 +53,7 @@ class URIManager(FileManager):
self._kwargs = {} if kwargs is None else dict(kwargs)
def acquire(self, needs_lock=True):
- return self._opener(*self._args, mode=self._mode, kwargs=self._kwargs)
+ return self._opener(*self._args, mode=self._mode, **self._kwargs)
def acquire_context(self, needs_lock=True):
yield self.acquire(needs_lock=needs_lock)
| corteva/rioxarray | 59a4ba52a122cd6783cbe8bde943a6afcd8a78ce | diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index 7d8191a..d471375 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -872,11 +872,12 @@ def test_rasterio_vrt_with_src_crs():
assert rds.rio.crs == src_crs
-def test_open_cog():
[email protected]("lock", [True, False])
+def test_open_cog(lock):
cog_file = os.path.join(TEST_INPUT_DATA_DIR, "cog.tif")
rdsm = rioxarray.open_rasterio(cog_file)
assert rdsm.shape == (1, 500, 500)
- rdso = rioxarray.open_rasterio(cog_file, overview_level=0)
+ rdso = rioxarray.open_rasterio(cog_file, lock=lock, overview_level=0)
assert rdso.shape == (1, 250, 250)
| overview not read when specifying chunks or lock
#### Code Sample, a copy-pastable example if possible
```python
import rasterio
import rioxarray
# from https://openaerialmap.org/
cog_url = (
"https://oin-hotosm.s3.amazonaws.com/"
"5d7dad0becaf880008a9bc88/0/5d7dad0becaf880008a9bc89.tif"
)
```
```python
ds = rioxarray.open_rasterio(cog_url, lock=False, chunks=(4, "auto", -1))
ds.shape
```
(3, 9984, 22016)
```python
dsLockChunksOverview = rioxarray.open_rasterio(cog_url, lock=False, chunks=(4, "auto", -1), overview_level=1)
dsLockChunksOverview.shape
```
(3, 9984, 22016)
```python
dsChunksOverview = rioxarray.open_rasterio(cog_url, chunks=(4, "auto", -1), overview_level=1)
dsChunksOverview.shape
```
(3, 9984, 22016)
```python
dsLockOverview = rioxarray.open_rasterio(cog_url, lock=False, overview_level=1)
dsLockOverview.shape
```
(3, 9984, 22016)
```python
dsOverview = rioxarray.open_rasterio(cog_url, overview_level=1)
dsOverview.shape
```
(3, 2496, 5504)
#### Problem description
Large COGs consequently have large overviews. It may be beneficial to read the overview in parallel without locks, as documented in [Reading COGs in Parallel](https://corteva.github.io/rioxarray/stable/examples/read-locks.html). Perhaps this behavior is documented, but I could not find it.
#### Expected Output
The correct shape of the overview `(3, 2496, 5504)` when specifying `overview_level` AND `chunks` or `lock`.
#### Environment Information
rioxarray (0.4.0) deps:
rasterio: 1.2.3
xarray: 0.18.2
GDAL: 3.2.2
Other python deps:
scipy: 1.6.3
pyproj: 3.0.1
System:
python: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
executable: /usr/bin/python3
machine: Linux-5.4.104+-x86_64-with-debian-10.9
#### Installation method
pypi | 0.0 | 59a4ba52a122cd6783cbe8bde943a6afcd8a78ce | [
"test/integration/test_integration__io.py::test_open_cog[False]"
]
| [
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-green-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue1-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:1blue-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable5-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-group6-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable7-group7-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-None-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-/PRODUCT-True]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_rasterio_mask_chunk_clip",
"test/integration/test_integration__io.py::test_serialization",
"test/integration/test_integration__io.py::test_utm",
"test/integration/test_integration__io.py::test_notransform",
"test/integration/test_integration__io.py::test_indexing",
"test/integration/test_integration__io.py::test_caching",
"test/integration/test_integration__io.py::test_chunks",
"test/integration/test_integration__io.py::test_pickle_rasterio",
"test/integration/test_integration__io.py::test_no_mftime",
"test/integration/test_integration__io.py::test_rasterio_environment",
"test/integration/test_integration__io.py::test_rasterio_vrt",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_transform_and_size",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_src_crs",
"test/integration/test_integration__io.py::test_open_cog[True]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_lockless",
"test/integration/test_integration__io.py::test_lock_true",
"test/integration/test_integration__io.py::test_non_rectilinear",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio_engine]"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-05-24 15:08:10+00:00 | apache-2.0 | 1,694 |
|
corteva__rioxarray-370 | diff --git a/docs/history.rst b/docs/history.rst
index 75761f5..1b6eced 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -3,7 +3,10 @@ History
Latest
------
-- BUG: Remove duplicate acquire in open_rasterio
+- ENH: Allow passing in kwargs to `rio.reproject` (issue #369; pull #370)
+- ENH: Allow nodata override and provide default nodata based on dtype in `rio.reproject` (pull #370)
+- ENH: Add support for passing in gcps to rio.reproject (issue #339; pull #370)
+- BUG: Remove duplicate acquire in open_rasterio (pull #364)
0.4.3
------
diff --git a/rioxarray/raster_array.py b/rioxarray/raster_array.py
index 75f7024..de0460e 100644
--- a/rioxarray/raster_array.py
+++ b/rioxarray/raster_array.py
@@ -18,6 +18,7 @@ import rasterio
import rasterio.mask
import rasterio.warp
import xarray
+from rasterio.dtypes import dtype_rev
from rasterio.enums import Resampling
from rasterio.features import geometry_mask
from scipy.interpolate import griddata
@@ -38,6 +39,24 @@ from rioxarray.raster_writer import (
)
from rioxarray.rioxarray import XRasterBase, _get_data_var_message, _make_coords
+# DTYPE TO NODATA MAP
+# Based on: https://github.com/OSGeo/gdal/blob/
+# cde27dc7641964a872efdc6bbcf5e3d3f7ab9cfd/gdal/
+# swig/python/gdal-utils/osgeo_utils/gdal_calc.py#L62
+_NODATA_DTYPE_MAP = {
+ 1: 255, # GDT_Byte
+ 2: 65535, # GDT_UInt16
+ 3: -32768, # GDT_Int16
+ 4: 4294967293, # GDT_UInt32
+ 5: -2147483647, # GDT_Int32
+ 6: 3.402823466e38, # GDT_Float32
+ 7: 1.7976931348623158e308, # GDT_Float64
+ 8: -32768, # GDT_CInt16
+ 9: -2147483647, # GDT_CInt32
+ 10: 3.402823466e38, # GDT_CFloat32
+ 11: 1.7976931348623158e308, # GDT_CFloat64
+}
+
def _generate_attrs(src_data_array, dst_nodata):
# add original attributes
@@ -87,10 +106,10 @@ def _add_attrs_proj(new_data_array, src_data_array):
def _make_dst_affine(
- src_data_array, src_crs, dst_crs, dst_resolution=None, dst_shape=None
+ src_data_array, src_crs, dst_crs, dst_resolution=None, dst_shape=None, **kwargs
):
"""Determine the affine of the new projected `xarray.DataArray`"""
- src_bounds = src_data_array.rio.bounds()
+ src_bounds = () if "gcps" in kwargs else src_data_array.rio.bounds()
src_height, src_width = src_data_array.rio.shape
dst_height, dst_width = dst_shape if dst_shape is not None else (None, None)
# pylint: disable=isinstance-second-argument-not-valid-type
@@ -98,22 +117,21 @@ def _make_dst_affine(
dst_resolution = tuple(abs(res_val) for res_val in dst_resolution)
elif dst_resolution is not None:
dst_resolution = abs(dst_resolution)
- resolution_or_width_height = {
- k: v
- for k, v in [
- ("resolution", dst_resolution),
- ("dst_height", dst_height),
- ("dst_width", dst_width),
- ]
- if v is not None
- }
+
+ for key, value in (
+ ("resolution", dst_resolution),
+ ("dst_height", dst_height),
+ ("dst_width", dst_width),
+ ):
+ if value is not None:
+ kwargs[key] = value
dst_affine, dst_width, dst_height = rasterio.warp.calculate_default_transform(
src_crs,
dst_crs,
src_width,
src_height,
*src_bounds,
- **resolution_or_width_height,
+ **kwargs,
)
return dst_affine, dst_width, dst_height
@@ -319,6 +337,8 @@ class RasterArray(XRasterBase):
shape=None,
transform=None,
resampling=Resampling.nearest,
+ nodata=None,
+ **kwargs,
):
"""
Reproject :obj:`xarray.DataArray` objects
@@ -332,6 +352,7 @@ class RasterArray(XRasterBase):
.. versionadded:: 0.0.27 shape
.. versionadded:: 0.0.28 transform
+ .. versionadded:: 0.5.0 nodata, kwargs
Parameters
----------
@@ -343,10 +364,21 @@ class RasterArray(XRasterBase):
shape: tuple(int, int), optional
Shape of the destination in pixels (dst_height, dst_width). Cannot be used
together with resolution.
- transform: optional
+ transform: Affine, optional
The destination transform.
resampling: rasterio.enums.Resampling, optional
See :func:`rasterio.warp.reproject` for more details.
+ nodata: float, optional
+ The nodata value used to initialize the destination;
+ it will remain in all areas not covered by the reprojected source.
+ Defaults to the nodata value of the source image if none provided
+ and exists or attempts to find an appropriate value by dtype.
+ **kwargs: dict
+ Additional keyword arguments to pass into :func:`rasterio.warp.reproject`.
+ To override:
+ - src_transform: `rio.write_transform`
+ - src_crs: `rio.write_crs`
+ - src_nodata: `rio.write_nodata`
Returns
@@ -361,10 +393,10 @@ class RasterArray(XRasterBase):
"CRS not found. Please set the CRS with 'rio.write_crs()'."
f"{_get_data_var_message(self._obj)}"
)
- src_affine = self.transform(recalc=True)
+ src_affine = None if "gcps" in kwargs else self.transform(recalc=True)
if transform is None:
dst_affine, dst_width, dst_height = _make_dst_affine(
- self._obj, self.crs, dst_crs, resolution, shape
+ self._obj, self.crs, dst_crs, resolution, shape, **kwargs
)
else:
dst_affine = transform
@@ -382,22 +414,24 @@ class RasterArray(XRasterBase):
else:
dst_data = np.zeros((dst_height, dst_width), dtype=self._obj.dtype.type)
- dst_nodata = self._obj.dtype.type(
- self.nodata if self.nodata is not None else -9999
- )
- src_nodata = self._obj.dtype.type(
- self.nodata if self.nodata is not None else dst_nodata
+ default_nodata = (
+ _NODATA_DTYPE_MAP[dtype_rev[self._obj.dtype.name]]
+ if self.nodata is None
+ else self.nodata
)
+ dst_nodata = default_nodata if nodata is None else nodata
+
rasterio.warp.reproject(
source=self._obj.values,
destination=dst_data,
src_transform=src_affine,
src_crs=self.crs,
- src_nodata=src_nodata,
+ src_nodata=self.nodata,
dst_transform=dst_affine,
dst_crs=dst_crs,
dst_nodata=dst_nodata,
resampling=resampling,
+ **kwargs,
)
# add necessary attributes
new_attrs = _generate_attrs(self._obj, dst_nodata)
diff --git a/rioxarray/raster_dataset.py b/rioxarray/raster_dataset.py
index 6cf80a0..e6f772b 100644
--- a/rioxarray/raster_dataset.py
+++ b/rioxarray/raster_dataset.py
@@ -58,6 +58,8 @@ class RasterDataset(XRasterBase):
shape=None,
transform=None,
resampling=Resampling.nearest,
+ nodata=None,
+ **kwargs,
):
"""
Reproject :class:`xarray.Dataset` objects
@@ -69,6 +71,7 @@ class RasterDataset(XRasterBase):
.. versionadded:: 0.0.27 shape
.. versionadded:: 0.0.28 transform
+ .. versionadded:: 0.5.0 nodata, kwargs
Parameters
----------
@@ -84,7 +87,17 @@ class RasterDataset(XRasterBase):
The destination transform.
resampling: rasterio.enums.Resampling, optional
See :func:`rasterio.warp.reproject` for more details.
-
+ nodata: float, optional
+ The nodata value used to initialize the destination;
+ it will remain in all areas not covered by the reprojected source.
+ Defaults to the nodata value of the source image if none provided
+ and exists or attempts to find an appropriate value by dtype.
+ **kwargs: dict
+ Additional keyword arguments to pass into :func:`rasterio.warp.reproject`.
+ To override:
+ - src_transform: `rio.write_transform`
+ - src_crs: `rio.write_crs`
+ - src_nodata: `rio.write_nodata`
Returns
--------
@@ -102,6 +115,8 @@ class RasterDataset(XRasterBase):
shape=shape,
transform=transform,
resampling=resampling,
+ nodata=nodata,
+ **kwargs,
)
)
return resampled_dataset
| corteva/rioxarray | 47bc0b8219bea94134c10c2a7e8e619d72d8f055 | diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index f5f2196..73455bf 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -60,7 +60,7 @@ jobs:
- name: Install Env
shell: bash
run: |
- conda create -n test python=${{ matrix.python-version }} rasterio=${{ matrix.rasterio-version }} xarray=${{ matrix.xarray-version }} scipy pyproj netcdf4 dask pandoc
+ conda create -n test python=${{ matrix.python-version }} rasterio=${{ matrix.rasterio-version }} xarray=${{ matrix.xarray-version }} 'libgdal<3.3' scipy pyproj netcdf4 dask pandoc
source activate test
python -m pip install -e .[all]
diff --git a/test/integration/test_integration_rioxarray.py b/test/integration/test_integration_rioxarray.py
index bced49b..baf04e8 100644
--- a/test/integration/test_integration_rioxarray.py
+++ b/test/integration/test_integration_rioxarray.py
@@ -15,6 +15,7 @@ from affine import Affine
from dask.delayed import Delayed
from numpy.testing import assert_almost_equal, assert_array_equal
from pyproj import CRS as pCRS
+from rasterio.control import GroundControlPoint
from rasterio.crs import CRS
from rasterio.windows import Window
@@ -699,7 +700,8 @@ def test_reproject__no_transform(modis_reproject):
_assert_xarrays_equal(mds_repr, mdc)
-def test_reproject__no_nodata(modis_reproject):
[email protected]("nodata", [None, -9999])
+def test_reproject__no_nodata(nodata, modis_reproject):
mask_args = (
dict(masked=False, mask_and_scale=False)
if "rasterio" in str(modis_reproject["open"])
@@ -712,19 +714,20 @@ def test_reproject__no_nodata(modis_reproject):
_del_attr(mda, "_FillValue")
_del_attr(mda, "nodata")
# reproject
- mds_repr = mda.rio.reproject(modis_reproject["to_proj"])
+ mds_repr = mda.rio.reproject(modis_reproject["to_proj"], nodata=nodata)
# overwrite test dataset
# if isinstance(modis_reproject['open'], xarray.DataArray):
# mds_repr.to_netcdf(modis_reproject['compare'])
# replace -9999 with original _FillValue for testing
+ fill_nodata = -32768 if nodata is None else nodata
if hasattr(mds_repr, "variables"):
for var in mds_repr.rio.vars:
- mds_repr[var].values[mds_repr[var].values == -9999] = orig_fill
+ mds_repr[var].values[mds_repr[var].values == fill_nodata] = orig_fill
else:
- mds_repr.values[mds_repr.values == -9999] = orig_fill
- _mod_attr(mdc, "_FillValue", val=-9999)
+ mds_repr.values[mds_repr.values == fill_nodata] = orig_fill
+ _mod_attr(mdc, "_FillValue", val=fill_nodata)
# test
_assert_xarrays_equal(mds_repr, mdc)
@@ -750,6 +753,47 @@ def test_reproject__no_nodata_masked(modis_reproject):
_assert_xarrays_equal(mds_repr, mdc)
+def test_reproject__gcps_kwargs(tmp_path):
+ tiffname = tmp_path / "test.tif"
+ src_gcps = [
+ GroundControlPoint(row=0, col=0, x=156113, y=2818720, z=0),
+ GroundControlPoint(row=0, col=800, x=338353, y=2785790, z=0),
+ GroundControlPoint(row=800, col=800, x=297939, y=2618518, z=0),
+ GroundControlPoint(row=800, col=0, x=115698, y=2651448, z=0),
+ ]
+ crs = CRS.from_epsg(32618)
+ with rasterio.open(
+ tiffname,
+ mode="w",
+ height=800,
+ width=800,
+ count=3,
+ dtype=numpy.uint8,
+ driver="GTiff",
+ ) as source:
+ source.gcps = (src_gcps, crs)
+
+ rds = rioxarray.open_rasterio(tiffname)
+ rds.rio.write_crs(crs, inplace=True)
+ rds = rds.rio.reproject(
+ crs,
+ gcps=src_gcps,
+ )
+ assert rds.rio.height == 923
+ assert rds.rio.width == 1027
+ assert rds.rio.crs == crs
+ assert rds.rio.transform().almost_equals(
+ Affine(
+ 216.8587081056465,
+ 0.0,
+ 115698.25,
+ 0.0,
+ -216.8587081056465,
+ 2818720.0,
+ )
+ )
+
+
def test_reproject_match(modis_reproject_match):
mask_args = (
dict(masked=False, mask_and_scale=False)
@@ -1069,6 +1113,7 @@ def test_geographic_reproject__missing_nodata():
mds_repr = mda.rio.reproject("epsg:32721")
# mds_repr.to_netcdf(sentinel_2_utm)
# test
+ _mod_attr(mdc, "_FillValue", val=65535)
_assert_xarrays_equal(mds_repr, mdc, precision=4)
| ENH: Allow passing in arguments into `rasterio.warp.transform` in `rio.reproject`
https://rasterio.readthedocs.io/en/latest/api/rasterio.warp.html#rasterio.warp.reproject
There are additional arguments that could be passed in such as:
```
gcps (sequence of GroundControlPoint, optional) – Ground control points for the source. An error will be raised if this parameter is defined together with src_transform or rpcs.
rpcs (RPC or dict, optional) – Rational polynomial coefficients for the source. An error will be raised if this parameter is defined together with src_transform or gcps.
src_alpha (int, optional) – Index of a band to use as the alpha band when warping.
dst_alpha (int, optional) – Index of a band to use as the alpha band when warping.
num_threads (int, optional) – The number of warp worker threads. Default: 1.
init_dest_nodata (bool) – Flag to specify initialization of nodata in destination; prevents overwrite of previous warps. Defaults to True.
warp_mem_limit (int, optional) – The warp operation memory limit in MB. Larger values allow the warp operation to be carried out in fewer chunks. The amount of memory required to warp a 3-band uint8 2000 row x 2000 col raster to a destination of the same size is approximately 56 MB. The default (0) means 64 MB with GDAL 2.2.
kwargs (dict, optional) – Additional arguments passed to transformation function.
```
| 0.0 | 47bc0b8219bea94134c10c2a7e8e619d72d8f055 | [
"test/integration/test_integration_rioxarray.py::test_reproject__gcps_kwargs",
"test/integration/test_integration_rioxarray.py::test_geographic_reproject__missing_nodata"
]
| [
"test/integration/test_integration_rioxarray.py::test_pad_box[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_pad_box[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func1-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func1-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func2-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func2-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio_engine-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio_engine-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func4-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func4-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func5-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func5-False]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_func3]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_func5]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_reproject__scalar_coord[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_reproject__scalar_coord[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine__single_point",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_func4]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_3d",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__all_nodata[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__all_nodata[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_load_in_geographic_dimensions",
"test/integration/test_integration_rioxarray.py::test_geographic_reproject",
"test/integration/test_integration_rioxarray.py::test_geographic_resample_integer",
"test/integration/test_integration_rioxarray.py::test_to_raster__custom_description__wrong",
"test/integration/test_integration_rioxarray.py::test_to_raster__dataset__different_crs",
"test/integration/test_integration_rioxarray.py::test_to_raster__dataset__different_nodata",
"test/integration/test_integration_rioxarray.py::test_missing_spatial_dimensions",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims__missing",
"test/integration/test_integration_rioxarray.py::test_crs_empty_dataset",
"test/integration/test_integration_rioxarray.py::test_crs_setter",
"test/integration/test_integration_rioxarray.py::test_crs_setter__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__missing",
"test/integration/test_integration_rioxarray.py::test_crs__dataset__different_crs",
"test/integration/test_integration_rioxarray.py::test_clip_missing_crs",
"test/integration/test_integration_rioxarray.py::test_reproject_missing_crs",
"test/integration/test_integration_rioxarray.py::test_reproject_resolution_and_shape_transform",
"test/integration/test_integration_rioxarray.py::test_reproject_transform_missing_shape",
"test/integration/test_integration_rioxarray.py::test_crs_get_custom",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset",
"test/integration/test_integration_rioxarray.py::test_write_crs_cf",
"test/integration/test_integration_rioxarray.py::test_write_crs_cf__disable_grid_mapping",
"test/integration/test_integration_rioxarray.py::test_write_crs__missing_geospatial_dims",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset__nonstandard_grid_mapping",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset__missing_grid_mapping_default",
"test/integration/test_integration_rioxarray.py::test_nodata_setter",
"test/integration/test_integration_rioxarray.py::test_nodata_setter__copy",
"test/integration/test_integration_rioxarray.py::test_write_nodata__array__copy",
"test/integration/test_integration_rioxarray.py::test_write_nodata__array__inplace",
"test/integration/test_integration_rioxarray.py::test_write_nodata__missing",
"test/integration/test_integration_rioxarray.py::test_write_nodata__remove",
"test/integration/test_integration_rioxarray.py::test_write_nodata__encoded",
"test/integration/test_integration_rioxarray.py::test_write_nodata__different_dtype[-1.1_0]",
"test/integration/test_integration_rioxarray.py::test_write_nodata__different_dtype[-1.1_1]",
"test/integration/test_integration_rioxarray.py::test_isel_window",
"test/integration/test_integration_rioxarray.py::test_write_pyproj_crs_dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip_box__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip_box_array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_slice_xy_array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_reproject__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_reproject__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_interpolate_na__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_interpolate_na__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_nodata__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_isel_window",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_error_msg",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__standard_name",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__standard_name__projected",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__axis",
"test/integration/test_integration_rioxarray.py::test_missing_crs_error_msg",
"test/integration/test_integration_rioxarray.py::test_missing_transform_bounds",
"test/integration/test_integration_rioxarray.py::test_missing_transform_resolution",
"test/integration/test_integration_rioxarray.py::test_write_transform__from_read",
"test/integration/test_integration_rioxarray.py::test_write_transform",
"test/integration/test_integration_rioxarray.py::test_write_read_transform__non_rectilinear",
"test/integration/test_integration_rioxarray.py::test_write_read_transform__non_rectilinear__warning",
"test/integration/test_integration_rioxarray.py::test_missing_transform",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__geographic",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__geographic__preserve_attrs",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__projected_ft",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__no_crs",
"test/integration/test_integration_rioxarray.py::test_grid_mapping__pre_existing[open_func0]",
"test/integration/test_integration_rioxarray.py::test_grid_mapping__change[open_func0]",
"test/integration/test_integration_rioxarray.py::test_grid_mapping_default",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs__missing_crs",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs__out_of_bounds",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_missing_nodata"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2021-07-06 15:45:47+00:00 | apache-2.0 | 1,695 |
|
corteva__rioxarray-388 | diff --git a/docs/history.rst b/docs/history.rst
index dfe640f..732d0f9 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -3,6 +3,7 @@ History
Latest
------
+- BUG: Fix indexing error when `mask_and_scale=True` was combined with band dim chunking (issue #387, pull #388)
0.6.0
------
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index 44c378d..e376254 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -288,11 +288,9 @@ class RasterioArrayWrapper(BackendArray):
if self.masked:
out = np.ma.filled(out.astype(self.dtype), self.fill_value)
if self.mask_and_scale:
- for band in np.atleast_1d(band_key):
- band_iii = band - 1
- out[band_iii] = (
- out[band_iii] * riods.scales[band_iii]
- + riods.offsets[band_iii]
+ for iii, band_iii in enumerate(np.atleast_1d(band_key) - 1):
+ out[iii] = (
+ out[iii] * riods.scales[band_iii] + riods.offsets[band_iii]
)
if squeeze_axis:
| corteva/rioxarray | 008c2a2c6f0147bd5e075fe6984eb8b636bd0bfc | diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index 0156f51..2b4da10 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -682,6 +682,23 @@ def test_chunks():
assert_allclose(ac, ex)
+def test_chunks_with_mask_and_scale():
+ with create_tmp_geotiff(
+ 10, 10, 4, transform_args=[1, 2, 0.5, 2.0], crs="+proj=latlong"
+ ) as (tmp_file, expected):
+ # Chunk at open time
+ with rioxarray.open_rasterio(
+ tmp_file, mask_and_scale=True, chunks=(1, 2, 2)
+ ) as actual:
+ assert isinstance(actual.data, dask.array.Array)
+ assert "open_rasterio" in actual.data.name
+
+ # do some arithmetic
+ ac = actual.mean().compute()
+ ex = expected.mean()
+ assert_allclose(ac, ex)
+
+
def test_pickle_rasterio():
# regression test for https://github.com/pydata/xarray/issues/2121
with create_tmp_geotiff() as (tmp_file, expected):
| IndexError on compute() when using mask_and_scale=True and dask chunking along band dimension
#### Code Sample, a copy-pastable example if possible
[tmp.tif.gz](https://github.com/corteva/rioxarray/files/6920344/tmp.tif.gz)
```python
import xarray as xr
import rioxarray as rxr
rs = rxr.open_rasterio("tmp.tif", mask_and_scale=True).chunk((1, 100, 100))
print(rs)
print(rs.compute())
```
#### Problem description
I get an `IndexError` when I try to do anything that causes a compute operation. This only happens if I use `mask_and_scale=True` when I open the tiff and then chunk along the band dimension. If I chunk with (N, H, W) and have N equal to the number of bands i.e. (4, 100, 100), it works fine. Chunking along the other dimensions doesn't cause an error. Only the band dimension causes problems.
#### Expected Output
```text
<xarray.DataArray (band: 4, y: 100, x: 100)>
dask.array<xarray-<this-array>, shape=(4, 100, 100), dtype=float32, chunksize=(1, 100, 100), chunktype=numpy.ndarray>
Coordinates:
* band (band) int64 1 2 3 4
* x (x) float64 7.819e+05 7.819e+05 7.819e+05 ... 7.82e+05 7.82e+05
* y (y) float64 3.407e+06 3.407e+06 ... 3.407e+06 3.407e+06
spatial_ref int64 0
<xarray.DataArray (band: 4, y: 100, x: 100)>
array([[[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]],
...
[[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]]], dtype=float32)
Coordinates:
* band (band) int64 1 2 3 4
* x (x) float64 7.819e+05 7.819e+05 7.819e+05 ... 7.82e+05 7.82e+05
* y (y) float64 3.407e+06 3.407e+06 ... 3.407e+06 3.407e+06
spatial_ref int64 0
```
#### Stack Trace
<details>
```text
Traceback (most recent call last):
File "my.py", line 6, in <module>
print(rs.compute())
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/dataarray.py", line 955, in compute
return new.load(**kwargs)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/dataarray.py", line 929, in load
ds = self._to_temp_dataset().load(**kwargs)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/dataset.py", line 865, in load
evaluated_data = da.compute(*lazy_data.values(), **kwargs)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/dask/base.py", line 568, in compute
results = schedule(dsk, keys, **kwargs)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/dask/threaded.py", line 79, in get
results = get_async(
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/dask/local.py", line 514, in get_async
raise_exception(exc, tb)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/dask/local.py", line 325, in reraise
raise exc
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/dask/local.py", line 223, in execute_task
result = _execute_task(task, data)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/dask/core.py", line 121, in _execute_task
return func(*(_execute_task(a, cache) for a in args))
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/dask/array/core.py", line 104, in getter
c = np.asarray(c)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/indexing.py", line 354, in __array__
return np.asarray(self.array, dtype=dtype)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/indexing.py", line 548, in __array__
self._ensure_cached()
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/indexing.py", line 545, in _ensure_cached
self.array = NumpyIndexingAdapter(np.asarray(self.array))
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/indexing.py", line 518, in __array__
return np.asarray(self.array, dtype=dtype)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/indexing.py", line 419, in __array__
return np.asarray(array[self.key], dtype=None)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/rioxarray/_io.py", line 305, in __getitem__
return indexing.explicit_indexing_adapter(
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/indexing.py", line 710, in explicit_indexing_adapter
result = raw_indexing_method(raw_key.tuple)
File "/home/$USER/anaconda3/envs/rstools/lib/python3.8/site-packages/rioxarray/_io.py", line 296, in _getitem
out[band_iii] * riods.scales[band_iii]
IndexError: index 1 is out of bounds for axis 0 with size 1
```
</details>
#### Environment Information
```text
rioxarray (0.6.0) deps:
rasterio: 1.2.6
xarray: 0.19.0
GDAL: 3.3.1
Other python deps:
scipy: 1.7.0
pyproj: 3.1.0
System:
python: 3.8.10 | packaged by conda-forge | (default, May 11 2021, 07:01:05) [GCC 9.3.0]
executable: /home/$USER/anaconda3/envs/rstools/bin/python
machine: Linux-5.11.0-25-generic-x86_64-with-glibc2.10
```
#### Installation method
- conda
#### Conda environment information (if you installed with conda):
<br/>
Environment (<code>conda list</code>):
<details>
```
$ conda list | grep -E "rasterio|xarray|gdal|dask"
dask 2021.7.2 pyhd8ed1ab_0 conda-forge
dask-core 2021.7.2 pyhd8ed1ab_0 conda-forge
dask-image 0.6.0 pyhd8ed1ab_0 conda-forge
libgdal 3.3.1 h8f005ca_1 conda-forge
rasterio 1.2.6 py38h84fce68_2 conda-forge
rioxarray 0.6.0 pyhd8ed1ab_0 conda-forge
xarray 0.19.0 pyhd8ed1ab_1 conda-forge
```
</details>
<br/>
Details about <code>conda</code> and system ( <code>conda info</code> ):
<details>
```
$ conda info
active environment : rstools
active env location : /home/$USER/anaconda3/envs/rstools
shell level : 3
user config file : /home/$USER/.condarc
populated config files : /home/$USER/.condarc
conda version : 4.10.3
conda-build version : not installed
python version : 3.8.10.final.0
virtual packages : __cuda=11.2=0
__linux=5.11.0=0
__glibc=2.33=0
__unix=0=0
__archspec=1=x86_64
base environment : /home/$USER/anaconda3 (writable)
conda av data dir : /home/$USER/anaconda3/etc/conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/$USER/anaconda3/pkgs
/home/$USER/.conda/pkgs
envs directories : /home/$USER/anaconda3/envs
/home/$USER/.conda/envs
platform : linux-64
user-agent : conda/4.10.3 requests/2.25.1 CPython/3.8.10 Linux/5.11.0-25-generic ubuntu/21.04 glibc/2.33
UID:GID : 1000:1000
netrc file : None
offline mode : False
```
</details> | 0.0 | 008c2a2c6f0147bd5e075fe6984eb8b636bd0bfc | [
"test/integration/test_integration__io.py::test_chunks_with_mask_and_scale"
]
| [
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-green-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue1-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:1blue-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable5-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-group6-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable7-group7-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-None-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-/PRODUCT-True]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_rasterio_mask_chunk_clip",
"test/integration/test_integration__io.py::test_serialization",
"test/integration/test_integration__io.py::test_utm",
"test/integration/test_integration__io.py::test_notransform",
"test/integration/test_integration__io.py::test_indexing",
"test/integration/test_integration__io.py::test_caching",
"test/integration/test_integration__io.py::test_chunks",
"test/integration/test_integration__io.py::test_pickle_rasterio",
"test/integration/test_integration__io.py::test_no_mftime",
"test/integration/test_integration__io.py::test_rasterio_environment",
"test/integration/test_integration__io.py::test_rasterio_vrt",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_transform_and_size",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_src_crs",
"test/integration/test_integration__io.py::test_rasterio_vrt_gcps",
"test/integration/test_integration__io.py::test_open_cog[True]",
"test/integration/test_integration__io.py::test_open_cog[False]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_lockless",
"test/integration/test_integration__io.py::test_lock_true",
"test/integration/test_integration__io.py::test_non_rectilinear",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio_engine]"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2021-08-03 07:51:58+00:00 | apache-2.0 | 1,696 |
|
corteva__rioxarray-516 | diff --git a/docs/history.rst b/docs/history.rst
index 48dea99..102f0f3 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -3,7 +3,7 @@ History
Latest
------
-
+- BUG: Fix WarpedVRT param cache in :func:`rioxarray.open_rasterio` (issue #515)
0.11.0
------
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index 5bd58db..86fa727 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -811,15 +811,15 @@ def open_rasterio(
filename = vrt.src_dataset.name
vrt_params = dict(
src_crs=vrt.src_crs.to_string() if vrt.src_crs else None,
- crs=vrt.crs.to_string() if vrt.crs else None,
+ crs=vrt.dst_crs.to_string() if vrt.dst_crs else None,
resampling=vrt.resampling,
tolerance=vrt.tolerance,
src_nodata=vrt.src_nodata,
- nodata=vrt.nodata,
- width=vrt.width,
- height=vrt.height,
+ nodata=vrt.dst_nodata,
+ width=vrt.dst_width,
+ height=vrt.dst_height,
src_transform=vrt.src_transform,
- transform=vrt.transform,
+ transform=vrt.dst_transform,
dtype=vrt.working_dtype,
warp_extras=vrt.warp_extras,
)
| corteva/rioxarray | 131b2cb244e56ea22d0c08a18e53beab842fb62e | diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index 7440923..fba3970 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -38,6 +38,11 @@ from test.integration.test_integration_rioxarray import (
_create_gdal_gcps,
)
+cint_skip = pytest.mark.skipif(
+ rasterio.__version__ < "1.2.4",
+ reason="https://github.com/mapbox/rasterio/issues/2182",
+)
+
@pytest.mark.parametrize(
"subdataset, variable, group, match",
@@ -932,6 +937,19 @@ def test_rasterio_vrt_gcps(tmp_path):
)
+@cint_skip
+def test_rasterio_vrt_gcps__data_exists():
+ # https://github.com/corteva/rioxarray/issues/515
+ vrt_file = os.path.join(TEST_INPUT_DATA_DIR, "cint16.tif")
+ with rasterio.open(vrt_file) as src:
+ crs = src.gcps[1]
+ # NOTE: Eventually src_crs will not need to be provided
+ # https://github.com/mapbox/rasterio/pull/2193
+ with rasterio.vrt.WarpedVRT(src, src_crs=crs) as vrt:
+ rds = rioxarray.open_rasterio(vrt)
+ assert rds.values.any()
+
+
@pytest.mark.parametrize("lock", [True, False])
def test_open_cog(lock):
cog_file = os.path.join(TEST_INPUT_DATA_DIR, "cog.tif")
@@ -1150,12 +1168,6 @@ def test_rotation_affine():
assert rioda.rio.resolution() == (10, 10)
-cint_skip = pytest.mark.skipif(
- rasterio.__version__ < "1.2.4",
- reason="https://github.com/mapbox/rasterio/issues/2182",
-)
-
-
@cint_skip
@pytest.mark.parametrize("dtype", [None, "complex_int16"])
def test_cint16_dtype(dtype, tmp_path):
| Opening VRT with GCPs results in DataArray of zeros
#### Code Sample, a copy-pastable example if possible
The following loads geo coordinates correctly, but the data array is all zeros
```python
import rioxarray
import rasterio
from rasterio.vrt import WarpedVRT
with rasterio.open('cint16.tif') as src:
with WarpedVRT(src) as vrt:
rds = rioxarray.open_rasterio(vrt)
rds.values.any() # False
```
#### Problem description
Opening a WarpedVRT with ground control points results in an array of zeros. But using `rio.reproject` works as expected:
#### Expected Output
There should be non-zero data values in the DataArray
```
da = rioxarray.open_rasterio('cint16.tif')
da = da.astype('f4')
daG = da.rio.reproject('EPSG:4326')
daG.values.any() # True
```
I used `cint16.tif` because it is already in rioxarray test data, but here is a gist with another data product with uint16 dtype with some plots too
https://gist.github.com/scottyhq/211d417aa826593d8b3cac1f3367be68
#### Environment Information
```
rioxarray (0.10.3) deps:
rasterio: 1.3a3
xarray: 2022.3.0
GDAL: 3.4.1
Other python deps:
scipy: 1.8.0
pyproj: 3.3.0
System:
python: 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:25:59) [GCC 10.3.0]
executable: /srv/conda/envs/sarsen/bin/python
machine: Linux-5.4.172-90.336.amzn2.x86_64-x86_64-with-glibc2.27
```
#### Installation method
- conda / conda-forge
| 0.0 | 131b2cb244e56ea22d0c08a18e53beab842fb62e | [
"test/integration/test_integration__io.py::test_rasterio_vrt_gcps__data_exists"
]
| [
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-green-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue1-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:1blue-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable5-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-group6-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable7-group7-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-None-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-/PRODUCT-True]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_rasterio_mask_chunk_clip",
"test/integration/test_integration__io.py::test_serialization",
"test/integration/test_integration__io.py::test_utm",
"test/integration/test_integration__io.py::test_platecarree",
"test/integration/test_integration__io.py::test_notransform",
"test/integration/test_integration__io.py::test_indexing",
"test/integration/test_integration__io.py::test_caching",
"test/integration/test_integration__io.py::test_chunks",
"test/integration/test_integration__io.py::test_chunks_with_mask_and_scale",
"test/integration/test_integration__io.py::test_pickle_rasterio",
"test/integration/test_integration__io.py::test_ENVI_tags",
"test/integration/test_integration__io.py::test_no_mftime",
"test/integration/test_integration__io.py::test_rasterio_environment",
"test/integration/test_integration__io.py::test_rasterio_vrt",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_transform_and_size",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_src_crs",
"test/integration/test_integration__io.py::test_rasterio_vrt_gcps",
"test/integration/test_integration__io.py::test_open_cog[True]",
"test/integration/test_integration__io.py::test_open_cog[False]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_lockless",
"test/integration/test_integration__io.py::test_lock_true",
"test/integration/test_integration__io.py::test_non_rectilinear",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_rotation_affine",
"test/integration/test_integration__io.py::test_reading_gcps"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2022-04-22 13:36:17+00:00 | apache-2.0 | 1,697 |
|
corteva__rioxarray-559 | diff --git a/docs/history.rst b/docs/history.rst
index 94fa691..7563f87 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -4,6 +4,7 @@ History
Latest
------
- BUG: Fix reading file handle with dask (issue #550)
+- BUG: Fix reading cint16 files with dask (issue #542)
0.11.1
------
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index 2b48629..fc26efd 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -680,7 +680,7 @@ def _prepare_dask(
chunks = normalize_chunks(
chunks=(1, "auto", "auto"),
shape=(riods.count, riods.height, riods.width),
- dtype=riods.dtypes[0],
+ dtype=_rasterio_to_numpy_dtype(riods.dtypes),
previous_chunks=tuple((c,) for c in block_shape),
)
token = tokenize(filename, mtime, chunks)
| corteva/rioxarray | 83cb348eb609d1766a82bbb99e8c3e5c1a2b1e25 | diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index 03ec767..52846fb 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -1314,3 +1314,9 @@ def test_read_file_handle_with_dask():
os.path.join(TEST_COMPARE_DATA_DIR, "small_dem_3m_merged.tif"), "rb"
) as src:
rioxarray.open_rasterio(src, chunks=2048)
+
+
+@cint_skip
+def test_read_cint16_with_dask():
+ test_file = os.path.join(TEST_INPUT_DATA_DIR, "cint16.tif")
+ rioxarray.open_rasterio(test_file, chunks=True)
| rasterio DatasetReader complex_int16 incompatible with auto chunking of dask (rioxarray.open_rasterio)
#### Code Sample, a copy-pastable example if possible
```python
import numpy as np
import rasterio
import rioxarray
filename = "complex_int16.tiff"
with rasterio.open(filename, mode='w', width=16, height=16, count=1, dtype="complex_int16") as writer:
writer.write(np.array([[[ i*j for j in range(16)] for i in range(16)]]))
rioxarray.open_rasterio(filename, chunks=True)
```
#### Problem description
When opening a file with `rioxarray.open_rasterio` passing `chunks=True`, `rasterio.DatasetReader` can have `"complex_int16"` dtype, that is incompatible with `dask.core.normalize_chunk` dtype parameter (line 682 in `rioxarray._io`) and cause `TypeError: data type 'complex_int16' not understood`.
rasterio manage `complex_int16` when reading data with `rasterio.dtypes._getnpdtype` and `rasterio.dtypes._is_complex_int` to translate internal `complex_int16` to `np.complex64` .
#### Expected Output
`rioxarray.open_rasterio` should work and provide a `xarray.DataArray` with `np.complex64` dtype in the case of processing a rasterio file with `complex_int16` dtype.
#### Environment Information
- Tested with rioxarray >= 0.10.2
- rasterio ==1.2.10
- Python 3.9.9
- Linux-5.13.0-51-generic-x86_64-with-glibc2.31
#### Installation method
- `pip install rioxarray==${TARGET_VERSION}`
| 0.0 | 83cb348eb609d1766a82bbb99e8c3e5c1a2b1e25 | [
"test/integration/test_integration__io.py::test_read_cint16_with_dask"
]
| [
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-green-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue1-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:1blue-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable5-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-group6-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable7-group7-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-None-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-/PRODUCT-True]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_rasterio_mask_chunk_clip",
"test/integration/test_integration__io.py::test_serialization",
"test/integration/test_integration__io.py::test_utm",
"test/integration/test_integration__io.py::test_platecarree",
"test/integration/test_integration__io.py::test_notransform",
"test/integration/test_integration__io.py::test_indexing",
"test/integration/test_integration__io.py::test_caching",
"test/integration/test_integration__io.py::test_chunks",
"test/integration/test_integration__io.py::test_chunks_with_mask_and_scale",
"test/integration/test_integration__io.py::test_pickle_rasterio",
"test/integration/test_integration__io.py::test_ENVI_tags",
"test/integration/test_integration__io.py::test_no_mftime",
"test/integration/test_integration__io.py::test_rasterio_environment",
"test/integration/test_integration__io.py::test_rasterio_vrt",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_transform_and_size",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_src_crs",
"test/integration/test_integration__io.py::test_rasterio_vrt_gcps",
"test/integration/test_integration__io.py::test_rasterio_vrt_gcps__data_exists",
"test/integration/test_integration__io.py::test_open_cog[True]",
"test/integration/test_integration__io.py::test_open_cog[False]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_lockless",
"test/integration/test_integration__io.py::test_lock_true",
"test/integration/test_integration__io.py::test_non_rectilinear",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_rotation_affine",
"test/integration/test_integration__io.py::test_reading_gcps",
"test/integration/test_integration__io.py::test_read_file_handle_with_dask"
]
| {
"failed_lite_validators": [
"has_media",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2022-08-16 14:31:04+00:00 | apache-2.0 | 1,698 |
|
corteva__rioxarray-560 | diff --git a/docs/history.rst b/docs/history.rst
index 7563f87..78f583d 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -5,6 +5,7 @@ Latest
------
- BUG: Fix reading file handle with dask (issue #550)
- BUG: Fix reading cint16 files with dask (issue #542)
+- BUG: Ensure `rio.bounds` ordered correctly (issue #545)
0.11.1
------
diff --git a/rioxarray/raster_array.py b/rioxarray/raster_array.py
index 3bf1685..3b3b872 100644
--- a/rioxarray/raster_array.py
+++ b/rioxarray/raster_array.py
@@ -50,7 +50,12 @@ from rioxarray.raster_writer import (
RasterioWriter,
_ensure_nodata_dtype,
)
-from rioxarray.rioxarray import XRasterBase, _get_data_var_message, _make_coords
+from rioxarray.rioxarray import (
+ XRasterBase,
+ _get_data_var_message,
+ _make_coords,
+ _order_bounds,
+)
# DTYPE TO NODATA MAP
# Based on: https://github.com/OSGeo/gdal/blob/
@@ -744,21 +749,17 @@ class RasterArray(XRasterBase):
f"{_get_data_var_message(self._obj)}"
)
+ resolution_x, resolution_y = self.resolution()
# make sure that if the coordinates are
# in reverse order that it still works
- resolution_x, resolution_y = self.resolution()
- if resolution_y < 0:
- top = maxy
- bottom = miny
- else:
- top = miny
- bottom = maxy
- if resolution_x < 0:
- left = maxx
- right = minx
- else:
- left = minx
- right = maxx
+ left, bottom, right, top = _order_bounds(
+ minx=minx,
+ miny=miny,
+ maxx=maxx,
+ maxy=maxy,
+ resolution_x=resolution_x,
+ resolution_y=resolution_y,
+ )
# pull the data out
window_error = None
diff --git a/rioxarray/rioxarray.py b/rioxarray/rioxarray.py
index 9819e75..d22a7b5 100644
--- a/rioxarray/rioxarray.py
+++ b/rioxarray/rioxarray.py
@@ -215,6 +215,33 @@ def _has_spatial_dims(
return True
+def _order_bounds(
+ minx: float,
+ miny: float,
+ maxx: float,
+ maxy: float,
+ resolution_x: float,
+ resolution_y: float,
+) -> Tuple[float, float, float, float]:
+ """
+ Make sure that the bounds are in the correct order
+ """
+ if resolution_y < 0:
+ top = maxy
+ bottom = miny
+ else:
+ top = miny
+ bottom = maxy
+ if resolution_x < 0:
+ left = maxx
+ right = minx
+ else:
+ left = minx
+ right = maxx
+
+ return left, bottom, right, top
+
+
class XRasterBase:
"""This is the base class for the GIS extensions for xarray"""
@@ -626,7 +653,7 @@ class XRasterBase:
return transform
try:
- src_left, _, _, src_top = self.bounds(recalc=recalc)
+ src_left, _, _, src_top = self._unordered_bounds(recalc=recalc)
src_resolution_x, src_resolution_y = self.resolution(recalc=recalc)
except (DimensionMissingCoordinateError, DimensionError):
return Affine.identity() if transform is None else transform
@@ -981,8 +1008,12 @@ class XRasterBase:
resolution_y = (bottom - top) / (self.height - 1)
return resolution_x, resolution_y
- def bounds(self, recalc: bool = False) -> Tuple[float, float, float, float]:
+ def _unordered_bounds(
+ self, recalc: bool = False
+ ) -> Tuple[float, float, float, float]:
"""
+ Unordered bounds.
+
Parameters
----------
recalc: bool, optional
@@ -1014,6 +1045,24 @@ class XRasterBase:
return left, bottom, right, top
+ def bounds(self, recalc: bool = False) -> Tuple[float, float, float, float]:
+ """
+ Parameters
+ ----------
+ recalc: bool, optional
+ Will force the bounds to be recalculated instead of using the
+ transform attribute.
+
+ Returns
+ -------
+ left, bottom, right, top: float
+ Outermost coordinates of the `xarray.DataArray` | `xarray.Dataset`.
+ """
+ return _order_bounds(
+ *self._unordered_bounds(recalc=recalc),
+ *self.resolution(recalc=recalc),
+ )
+
def isel_window(
self, window: rasterio.windows.Window, pad: bool = False
) -> Union[xarray.Dataset, xarray.DataArray]:
| corteva/rioxarray | f9ce51ed06359a1fe81ac9c3fde3906551b84e25 | diff --git a/test/integration/test_integration_rioxarray.py b/test/integration/test_integration_rioxarray.py
index cbc7c1b..94aa9d6 100644
--- a/test/integration/test_integration_rioxarray.py
+++ b/test/integration/test_integration_rioxarray.py
@@ -2901,3 +2901,15 @@ def test_reproject__gcps_file(tmp_path):
2818720.0,
)
)
+
+
+def test_bounds__ordered__dataarray():
+ xds = xarray.DataArray(
+ numpy.zeros((5, 5)), dims=("y", "x"), coords={"x": range(5), "y": range(5)}
+ )
+ assert xds.rio.bounds() == (-0.5, -0.5, 4.5, 4.5)
+
+
+def test_bounds__ordered__dataset():
+ xds = xarray.Dataset(None, coords={"x": range(5), "y": range(5)})
+ assert xds.rio.bounds() == (-0.5, -0.5, 4.5, 4.5)
| "incorrect" bounds (clip_box, pad_box)
#### Code Sample
```python
ds = xr.Dataset(None, {"x": range(5), "y": range(5)})
ds.rio.bounds()
```
This returns `(-0.5, 4.5, 4.5, -0.5)`, where the values represent `xmin, ymin, xmax, ymax` I believe. As you can see, `ymin > ymax`. I can solve this by assuring that the `y` coordinates are descending instead of ascending:
```python
ds = xr.Dataset(None, {"x": range(5), "y": range(5)})
ds = ds.sortby(ds.y, ascending=False)
ds.rio.bounds()
```
Gives `(-0.5, -0.5, 4.5, 4.5)`.
#### Problem description
I'm trying to use `rio.clip_box` and then `rio.pad_box` on a dataset, but I'm running into errors which are solved when making sure that `ymin` is smaller than `ymax`.
Shouldn't `rio.bounds` check what is the actual minimum value in `ds.y` (e.g. doing somethings like `ds.y.min()`), instead of doing something like `ds.y.isel(y = 0)`?
#### Environment Information
```
rioxarray (0.11.1) deps:
rasterio: 1.2.10
xarray: 2022.3.0
GDAL: 3.3.2
GEOS: None
PROJ: None
PROJ DATA: None
GDAL DATA: None
Other python deps:
scipy: 1.8.0
pyproj: 3.3.0
System:
python: 3.8.12 | packaged by conda-forge | (default, Jan 30 2022, 23:33:09) [Clang 11.1.0 ]
executable: /Users/hmcoerver/miniconda3/envs/pywapor/bin/python
machine: macOS-10.16-x86_64-i386-64bit
```
#### Conda environment information (if you installed with conda):
<br/>
Environment (<code>conda list</code>):
<details>
```
gdal 3.4.2 py38h0b97839_0 conda-forge
libgdal 3.4.2 h52a0caa_0 conda-forge
rasterio 1.2.10 pypi_0 pypi
rioxarray 0.11.1 pypi_0 pypi
xarray 2022.3.0 pypi_0 pypi
```
</details>
<br/>
Details about <code>conda</code> and system ( <code>conda info</code> ):
<details>
```
active environment : pywapor
active env location : /Users/hmcoerver/miniconda3/envs/pywapor
shell level : 2
user config file : /Users/hmcoerver/.condarc
populated config files :
conda version : 4.11.0
conda-build version : 3.21.4
python version : 3.8.12.final.0
virtual packages : __osx=10.16=0
__unix=0=0
__archspec=1=x86_64
base environment : /Users/hmcoerver/miniconda3 (writable)
conda av data dir : /Users/hmcoerver/miniconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /Users/hmcoerver/miniconda3/pkgs
/Users/hmcoerver/.conda/pkgs
envs directories : /Users/hmcoerver/miniconda3/envs
/Users/hmcoerver/.conda/envs
platform : osx-64
user-agent : conda/4.11.0 requests/2.27.1 CPython/3.8.12 Darwin/20.6.0 OSX/10.16
UID:GID : 501:20
netrc file : None
offline mode : False
```
</details>
| 0.0 | f9ce51ed06359a1fe81ac9c3fde3906551b84e25 | [
"test/integration/test_integration_rioxarray.py::test_bounds__ordered__dataarray",
"test/integration/test_integration_rioxarray.py::test_bounds__ordered__dataset"
]
| [
"test/integration/test_integration_rioxarray.py::test_pad_box[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_pad_box[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_in_bounds",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func1-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func1-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func2-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func2-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio_engine-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio_engine-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func4-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func4-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func5-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func5-False]",
"test/integration/test_integration_rioxarray.py::test_clip__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_clip_box__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_reproject__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_reproject_match__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_pad_box__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_func3]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_func5]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_reproject_3d[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_reproject_3d[open_func1]",
"test/integration/test_integration_rioxarray.py::test_reproject_3d[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_reproject_3d[open_func3]",
"test/integration/test_integration_rioxarray.py::test_reproject__scalar_coord[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_reproject__scalar_coord[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_reproject__gcps_kwargs",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine__single_point",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_func4]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_veris",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_3d",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__all_nodata[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__all_nodata[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_load_in_geographic_dimensions",
"test/integration/test_integration_rioxarray.py::test_geographic_reproject",
"test/integration/test_integration_rioxarray.py::test_geographic_reproject__missing_nodata",
"test/integration/test_integration_rioxarray.py::test_geographic_resample_integer",
"test/integration/test_integration_rioxarray.py::test_to_raster__custom_description__wrong",
"test/integration/test_integration_rioxarray.py::test_to_raster__dataset__different_crs",
"test/integration/test_integration_rioxarray.py::test_to_raster__dataset__different_nodata",
"test/integration/test_integration_rioxarray.py::test_missing_spatial_dimensions",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims__missing",
"test/integration/test_integration_rioxarray.py::test_crs_empty_dataset",
"test/integration/test_integration_rioxarray.py::test_crs_setter",
"test/integration/test_integration_rioxarray.py::test_crs_setter__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__missing",
"test/integration/test_integration_rioxarray.py::test_crs__dataset__different_crs",
"test/integration/test_integration_rioxarray.py::test_clip_missing_crs",
"test/integration/test_integration_rioxarray.py::test_reproject_missing_crs",
"test/integration/test_integration_rioxarray.py::test_reproject_resolution_and_shape_transform",
"test/integration/test_integration_rioxarray.py::test_reproject_transform_missing_shape",
"test/integration/test_integration_rioxarray.py::test_crs_get_custom",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset",
"test/integration/test_integration_rioxarray.py::test_crs_is_removed",
"test/integration/test_integration_rioxarray.py::test_write_crs_cf",
"test/integration/test_integration_rioxarray.py::test_write_crs_cf__disable_grid_mapping",
"test/integration/test_integration_rioxarray.py::test_write_crs__missing_geospatial_dims",
"test/integration/test_integration_rioxarray.py::test_read_crs_cf",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset__nonstandard_grid_mapping",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset__missing_grid_mapping_default",
"test/integration/test_integration_rioxarray.py::test_nodata_setter",
"test/integration/test_integration_rioxarray.py::test_nodata_setter__copy",
"test/integration/test_integration_rioxarray.py::test_write_nodata__array__copy",
"test/integration/test_integration_rioxarray.py::test_write_nodata__array__inplace",
"test/integration/test_integration_rioxarray.py::test_write_nodata__missing",
"test/integration/test_integration_rioxarray.py::test_write_nodata__remove",
"test/integration/test_integration_rioxarray.py::test_write_nodata__encoded",
"test/integration/test_integration_rioxarray.py::test_write_nodata__different_dtype[-1.1_0]",
"test/integration/test_integration_rioxarray.py::test_write_nodata__different_dtype[-1.1_1]",
"test/integration/test_integration_rioxarray.py::test_isel_window",
"test/integration/test_integration_rioxarray.py::test_isel_window_wpad",
"test/integration/test_integration_rioxarray.py::test_write_pyproj_crs_dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip_box__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip_box_array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_slice_xy_array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_reproject__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_reproject__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_interpolate_na__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_interpolate_na__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_nodata__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_isel_window",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_error_msg",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__standard_name",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__standard_name__projected",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__axis",
"test/integration/test_integration_rioxarray.py::test_missing_crs_error_msg",
"test/integration/test_integration_rioxarray.py::test_missing_transform_bounds",
"test/integration/test_integration_rioxarray.py::test_missing_transform_resolution",
"test/integration/test_integration_rioxarray.py::test_write_transform__from_read",
"test/integration/test_integration_rioxarray.py::test_write_transform",
"test/integration/test_integration_rioxarray.py::test_write_read_transform__non_rectilinear",
"test/integration/test_integration_rioxarray.py::test_write_read_transform__non_rectilinear__rotation__warning",
"test/integration/test_integration_rioxarray.py::test_missing_transform",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__geographic",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__geographic__preserve_attrs",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__projected_ft",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__no_crs",
"test/integration/test_integration_rioxarray.py::test_grid_mapping__pre_existing[open_func0]",
"test/integration/test_integration_rioxarray.py::test_grid_mapping__change[open_func0]",
"test/integration/test_integration_rioxarray.py::test_grid_mapping_default",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs__missing_crs",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs__out_of_bounds",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_missing_nodata",
"test/integration/test_integration_rioxarray.py::test_rio_write_gcps",
"test/integration/test_integration_rioxarray.py::test_rio_get_gcps",
"test/integration/test_integration_rioxarray.py::test_reproject__gcps_file"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-08-16 19:46:02+00:00 | apache-2.0 | 1,699 |
|
corteva__rioxarray-575 | diff --git a/docs/history.rst b/docs/history.rst
index 5a028e2..a7b459e 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -3,6 +3,7 @@ History
Latest
------
+- BUG: Handle `_Unsigned` and load in all attributes (pull #575)
0.12.0
-------
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index 629ba27..d91df3f 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -11,10 +11,11 @@ import os
import re
import threading
import warnings
-from typing import Any, Dict, Hashable, List, Optional, Tuple, Union
+from typing import Any, Dict, Hashable, Iterable, List, Optional, Tuple, Union
import numpy as np
import rasterio
+from numpy.typing import NDArray
from packaging import version
from rasterio.errors import NotGeoreferencedWarning
from rasterio.vrt import WarpedVRT
@@ -39,6 +40,18 @@ NO_LOCK = contextlib.nullcontext()
RasterioReader = Union[rasterio.io.DatasetReader, rasterio.vrt.WarpedVRT]
+def _get_unsigned_dtype(unsigned, dtype):
+ """
+ Based on: https://github.com/pydata/xarray/blob/abe1e613a96b000ae603c53d135828df532b952e/xarray/coding/variables.py#L306-L334
+ """
+ dtype = np.dtype(dtype)
+ if unsigned is True and dtype.kind == "i":
+ return np.dtype(f"u{dtype.itemsize}")
+ if unsigned is False and dtype.kind == "u":
+ return np.dtype(f"i{dtype.itemsize}")
+ return None
+
+
class FileHandleLocal(threading.local):
"""
This contains the thread local ThreadURIManager
@@ -173,28 +186,31 @@ class RasterioArrayWrapper(BackendArray):
self._shape = (riods.count, riods.height, riods.width)
self._dtype = None
+ self._unsigned_dtype = None
+ self._fill_value = riods.nodata
dtypes = riods.dtypes
if not np.all(np.asarray(dtypes) == dtypes[0]):
raise ValueError("All bands should have the same dtype")
dtype = _rasterio_to_numpy_dtype(dtypes)
-
- # handle unsigned case
- if mask_and_scale and unsigned and dtype.kind == "i":
- self._dtype = np.dtype(f"u{dtype.itemsize}")
- elif mask_and_scale and unsigned:
- warnings.warn(
- f"variable {name!r} has _Unsigned attribute but is not "
- "of integer type. Ignoring attribute.",
- variables.SerializationWarning,
- stacklevel=3,
+ if mask_and_scale and unsigned is not None:
+ self._unsigned_dtype = _get_unsigned_dtype(
+ unsigned=unsigned,
+ dtype=dtype,
)
- self._fill_value = riods.nodata
- if self._dtype is None:
- if self.masked:
- self._dtype, self._fill_value = maybe_promote(dtype)
- else:
- self._dtype = dtype
+ if self._unsigned_dtype is not None and self._fill_value is not None:
+ self._fill_value = self._unsigned_dtype.type(self._fill_value)
+ if self._unsigned_dtype is None and dtype.kind not in ("i", "u"):
+ warnings.warn(
+ f"variable {name!r} has _Unsigned attribute but is not "
+ "of integer type. Ignoring attribute.",
+ variables.SerializationWarning,
+ stacklevel=3,
+ )
+ if self.masked:
+ self._dtype, self._fill_value = maybe_promote(dtype)
+ else:
+ self._dtype = dtype
@property
def dtype(self):
@@ -288,6 +304,8 @@ class RasterioArrayWrapper(BackendArray):
if self.vrt_params is not None:
riods = WarpedVRT(riods, **self.vrt_params)
out = riods.read(band_key, window=window, masked=self.masked)
+ if self._unsigned_dtype is not None:
+ out = out.astype(self._unsigned_dtype)
if self.masked:
out = np.ma.filled(out.astype(self.dtype), self.fill_value)
if self.mask_and_scale:
@@ -418,29 +436,44 @@ def _load_netcdf_attrs(tags: Dict, data_array: DataArray) -> None:
data_array.coords[variable_name].attrs.update({attr_name: value})
+def _parse_netcdf_attr_array(attr: Union[NDArray, str], dtype=None) -> NDArray:
+ """
+ Expected format: '{2,6}' or '[2. 6.]'
+ """
+ value: Union[NDArray, str, List]
+ if isinstance(attr, str):
+ if attr.startswith("{"):
+ value = attr.strip("{}").split(",")
+ else:
+ value = attr.strip("[]").split()
+ elif not isinstance(attr, Iterable):
+ value = [attr]
+ else:
+ value = attr
+ return np.array(value, dtype=dtype)
+
+
def _load_netcdf_1d_coords(tags: Dict) -> Dict:
"""
Dimension information:
- NETCDF_DIM_EXTRA: '{time}' (comma separated list of dim names)
- - NETCDF_DIM_time_DEF: '{2,6}' (dim size, dim dtype)
- - NETCDF_DIM_time_VALUES: '{0,872712.659688}' (comma separated list of data)
+ - NETCDF_DIM_time_DEF: '{2,6}' or '[2. 6.]' (dim size, dim dtype)
+ - NETCDF_DIM_time_VALUES: '{0,872712.659688}' (comma separated list of data) or [ 0. 872712.659688]
"""
dim_names = tags.get("NETCDF_DIM_EXTRA")
if not dim_names:
return {}
- dim_names = dim_names.strip("{}").split(",")
+ dim_names = _parse_netcdf_attr_array(dim_names)
coords = {}
for dim_name in dim_names:
dim_def = tags.get(f"NETCDF_DIM_{dim_name}_DEF")
- if not dim_def:
+ if dim_def is None:
continue
# pylint: disable=unused-variable
- dim_size, dim_dtype = dim_def.strip("{}").split(",")
- dim_dtype = NETCDF_DTYPE_MAP.get(int(dim_dtype), object)
- dim_values = tags[f"NETCDF_DIM_{dim_name}_VALUES"].strip("{}")
- coords[dim_name] = IndexVariable(
- dim_name, np.fromstring(dim_values, dtype=dim_dtype, sep=",")
- )
+ dim_size, dim_dtype = _parse_netcdf_attr_array(dim_def)
+ dim_dtype = NETCDF_DTYPE_MAP.get(int(float(dim_dtype)), object)
+ dim_values = _parse_netcdf_attr_array(tags[f"NETCDF_DIM_{dim_name}_VALUES"])
+ coords[dim_name] = IndexVariable(dim_name, dim_values)
return coords
@@ -491,7 +524,7 @@ def _get_rasterio_attrs(riods: RasterioReader):
"""
# pylint: disable=too-many-branches
# Add rasterio attributes
- attrs = _parse_tags(riods.tags(1))
+ attrs = _parse_tags({**riods.tags(), **riods.tags(1)})
if riods.nodata is not None:
# The nodata values for the raster bands
attrs["_FillValue"] = riods.nodata
@@ -591,6 +624,19 @@ def _parse_driver_tags(
attrs[key] = value
+def _pop_global_netcdf_attrs_from_vars(dataset_to_clean: Dataset) -> Dataset:
+ # remove GLOBAL netCDF attributes from dataset variables
+ for coord in dataset_to_clean.coords:
+ for variable in dataset_to_clean.variables:
+ dataset_to_clean[variable].attrs = {
+ attr: value
+ for attr, value in dataset_to_clean[variable].attrs.items()
+ if attr not in dataset_to_clean.attrs
+ and not attr.startswith(f"{coord}#")
+ }
+ return dataset_to_clean
+
+
def _load_subdatasets(
riods: RasterioReader,
group: Optional[Union[str, List[str], Tuple[str, ...]]],
@@ -608,7 +654,7 @@ def _load_subdatasets(
"""
Load in rasterio subdatasets
"""
- base_tags = _parse_tags(riods.tags())
+ global_tags = _parse_tags(riods.tags())
dim_groups = {}
subdataset_filter = None
if any((group, variable)):
@@ -638,12 +684,15 @@ def _load_subdatasets(
if len(dim_groups) > 1:
dataset: Union[Dataset, List[Dataset]] = [
- Dataset(dim_group, attrs=base_tags) for dim_group in dim_groups.values()
+ _pop_global_netcdf_attrs_from_vars(Dataset(dim_group, attrs=global_tags))
+ for dim_group in dim_groups.values()
]
elif not dim_groups:
- dataset = Dataset(attrs=base_tags)
+ dataset = Dataset(attrs=global_tags)
else:
- dataset = Dataset(list(dim_groups.values())[0], attrs=base_tags)
+ dataset = _pop_global_netcdf_attrs_from_vars(
+ Dataset(list(dim_groups.values())[0], attrs=global_tags)
+ )
return dataset
@@ -689,7 +738,11 @@ def _prepare_dask(
def _handle_encoding(
- result: DataArray, mask_and_scale: bool, masked: bool, da_name: Optional[Hashable]
+ result: DataArray,
+ mask_and_scale: bool,
+ masked: bool,
+ da_name: Optional[Hashable],
+ unsigned: Union[bool, None],
) -> None:
"""
Make sure encoding handled properly
@@ -711,6 +764,16 @@ def _handle_encoding(
result.attrs, result.encoding, "missing_value", name=da_name
)
+ if mask_and_scale and unsigned is not None and "_FillValue" in result.encoding:
+ unsigned_dtype = _get_unsigned_dtype(
+ unsigned=unsigned,
+ dtype=result.encoding["dtype"],
+ )
+ if unsigned_dtype is not None:
+ result.encoding["_FillValue"] = unsigned_dtype.type(
+ result.encoding["_FillValue"]
+ )
+
def open_rasterio(
filename: Union[
@@ -879,13 +942,19 @@ def open_rasterio(
# parse tags & load alternate coords
attrs = _get_rasterio_attrs(riods=riods)
- coords = _load_netcdf_1d_coords(riods.tags())
+ coords = _load_netcdf_1d_coords(attrs)
_parse_driver_tags(riods=riods, attrs=attrs, coords=coords)
for coord in coords:
if f"NETCDF_DIM_{coord}" in attrs:
coord_name = coord
attrs.pop(f"NETCDF_DIM_{coord}")
break
+ if f"NETCDF_DIM_{coord}_VALUES" in attrs:
+ coord_name = coord
+ attrs.pop(f"NETCDF_DIM_{coord}_VALUES")
+ attrs.pop(f"NETCDF_DIM_{coord}_DEF", None)
+ attrs.pop("NETCDF_DIM_EXTRA", None)
+ break
else:
coord_name = "band"
coords[coord_name] = np.asarray(riods.indexes)
@@ -900,7 +969,7 @@ def open_rasterio(
_generate_spatial_coords(riods.transform, riods.width, riods.height)
)
- unsigned = False
+ unsigned = None
encoding: Dict[Hashable, Any] = {}
if mask_and_scale and "_Unsigned" in attrs:
unsigned = variables.pop_to(attrs, encoding, "_Unsigned") == "true"
@@ -938,11 +1007,11 @@ def open_rasterio(
)
# make sure the _FillValue is correct dtype
- if "_FillValue" in attrs:
- attrs["_FillValue"] = result.dtype.type(attrs["_FillValue"])
+ if "_FillValue" in result.attrs:
+ result.attrs["_FillValue"] = result.dtype.type(result.attrs["_FillValue"])
# handle encoding
- _handle_encoding(result, mask_and_scale, masked, da_name)
+ _handle_encoding(result, mask_and_scale, masked, da_name, unsigned=unsigned)
# Affine transformation matrix (always available)
# This describes coefficients mapping pixel coordinates to CRS
# For serialization store as tuple of 6 floats, the last row being
@@ -964,4 +1033,18 @@ def open_rasterio(
# add file path to encoding
result.encoding["source"] = riods.name
result.encoding["rasterio_dtype"] = str(riods.dtypes[0])
+ # remove duplicate coordinate information
+ for coord in result.coords:
+ result.attrs = {
+ attr: value
+ for attr, value in result.attrs.items()
+ if not attr.startswith(f"{coord}#")
+ }
+ # remove duplicate tags
+ if result.name:
+ result.attrs = {
+ attr: value
+ for attr, value in result.attrs.items()
+ if not attr.startswith(f"{result.name}#")
+ }
return result
diff --git a/rioxarray/raster_writer.py b/rioxarray/raster_writer.py
index c737a03..7d49d35 100644
--- a/rioxarray/raster_writer.py
+++ b/rioxarray/raster_writer.py
@@ -15,6 +15,7 @@ import rasterio
from rasterio.windows import Window
from xarray.conventions import encode_cf_variable
+from rioxarray._io import _get_unsigned_dtype
from rioxarray.exceptions import RioXarrayError
try:
@@ -39,7 +40,11 @@ def _write_metatata_to_raster(raster_handle, xarray_dataset, tags):
"""
Write the metadata stored in the xarray object to raster metadata
"""
- tags = xarray_dataset.attrs if tags is None else {**xarray_dataset.attrs, **tags}
+ tags = (
+ xarray_dataset.attrs.copy()
+ if tags is None
+ else {**xarray_dataset.attrs, **tags}
+ )
# write scales and offsets
try:
@@ -224,11 +229,25 @@ class RasterioWriter:
**kwargs
Keyword arguments to pass into writing the raster.
"""
+ xarray_dataarray = xarray_dataarray.copy()
kwargs["dtype"], numpy_dtype = _get_dtypes(
kwargs["dtype"],
xarray_dataarray.encoding.get("rasterio_dtype"),
xarray_dataarray.encoding.get("dtype", str(xarray_dataarray.dtype)),
)
+ # there is no equivalent for netCDF _Unsigned
+ # across output GDAL formats. It is safest to convert beforehand.
+ # https://github.com/OSGeo/gdal/issues/6352#issuecomment-1245981837
+ if "_Unsigned" in xarray_dataarray.encoding:
+ unsigned_dtype = _get_unsigned_dtype(
+ unsigned=xarray_dataarray.encoding["_Unsigned"] == "true",
+ dtype=numpy_dtype,
+ )
+ if unsigned_dtype is not None:
+ numpy_dtype = unsigned_dtype
+ kwargs["dtype"] = unsigned_dtype
+ xarray_dataarray.encoding["rasterio_dtype"] = str(unsigned_dtype)
+ xarray_dataarray.encoding["dtype"] = str(unsigned_dtype)
if kwargs["nodata"] is not None:
# Ensure dtype of output data matches the expected dtype.
| corteva/rioxarray | f23d3d44928272e560ca2bab65494331ed816139 | diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 5881c48..6a8f4f1 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -136,6 +136,7 @@ jobs:
conda info
- name: pylint
+ if: matrix.python-version == '3.8'
shell: bash
run: |
source activate test
@@ -143,6 +144,7 @@ jobs:
- name: mypy
shell: bash
+ if: matrix.python-version == '3.8'
run: |
source activate test
mypy rioxarray/
diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index 8cf7f62..22ec6be 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -23,7 +23,6 @@ from rasterio.errors import NotGeoreferencedWarning
from rasterio.transform import from_origin
from rasterio.warp import calculate_default_transform
from xarray import DataArray
-from xarray.coding.variables import SerializationWarning
from xarray.testing import assert_allclose, assert_equal, assert_identical
import rioxarray
@@ -258,11 +257,16 @@ def test_open_group_load_attrs(open_rasterio):
) as rds:
attrs = rds["sur_refl_b05_1"].attrs
assert sorted(attrs) == [
+ "Nadir Data Resolution",
"_FillValue",
"add_offset",
+ "add_offset_err",
+ "calibrated_nt",
"long_name",
"scale_factor",
+ "scale_factor_err",
"units",
+ "valid_range",
]
assert attrs["long_name"] == "500m Surface Reflectance Band 5 - first layer"
assert attrs["units"] == "reflectance"
@@ -299,6 +303,7 @@ def test_open_rasterio_mask_chunk_clip():
(3.0, 0.0, 425047.68381405267, 0.0, -3.0, 4615780.040546387),
)
assert attrs == {
+ "AREA_OR_POINT": "Area",
"add_offset": 0.0,
"scale_factor": 1.0,
}
@@ -967,35 +972,33 @@ def test_open_cog(lock):
def test_mask_and_scale(open_rasterio):
test_file = os.path.join(TEST_INPUT_DATA_DIR, "tmmx_20190121.nc")
- with pytest.warns(SerializationWarning):
- with open_rasterio(test_file, mask_and_scale=True) as rds:
- assert np.nanmin(rds.air_temperature.values) == np.float32(248.7)
- assert np.nanmax(rds.air_temperature.values) == np.float32(302.1)
- test_encoding = dict(rds.air_temperature.encoding)
- source = test_encoding.pop("source")
- assert source.startswith("netcdf:") and source.endswith(
- "tmmx_20190121.nc:air_temperature"
- )
- assert test_encoding == {
- "_Unsigned": "true",
- "add_offset": 220.0,
- "scale_factor": 0.1,
- "_FillValue": 32767.0,
- "missing_value": 32767,
- "grid_mapping": "crs",
- "dtype": "uint16",
- "rasterio_dtype": "uint16",
- }
- attrs = rds.air_temperature.attrs
- assert attrs == {
- "coordinates": "day",
- "coordinate_system": "WGS84,EPSG:4326",
- "description": "Daily Maximum Temperature",
- "dimensions": "lon lat time",
- "long_name": "tmmx",
- "standard_name": "tmmx",
- "units": "K",
- }
+ with open_rasterio(test_file, mask_and_scale=True) as rds:
+ assert np.nanmin(rds.air_temperature.values) == np.float32(248.7)
+ assert np.nanmax(rds.air_temperature.values) == np.float32(302.1)
+ test_encoding = dict(rds.air_temperature.encoding)
+ source = test_encoding.pop("source")
+ assert source.startswith("netcdf:") and source.endswith(
+ "tmmx_20190121.nc:air_temperature"
+ )
+ assert test_encoding == {
+ "_Unsigned": "true",
+ "add_offset": 220.0,
+ "scale_factor": 0.1,
+ "_FillValue": 32767.0,
+ "missing_value": 32767,
+ "grid_mapping": "crs",
+ "dtype": "uint16",
+ "rasterio_dtype": "uint16",
+ }
+ attrs = rds.air_temperature.attrs
+ assert attrs == {
+ "coordinates": "day",
+ "description": "Daily Maximum Temperature",
+ "dimensions": "lon lat time",
+ "long_name": "tmmx",
+ "standard_name": "tmmx",
+ "units": "K",
+ }
def test_no_mask_and_scale(open_rasterio):
@@ -1023,7 +1026,6 @@ def test_no_mask_and_scale(open_rasterio):
"_Unsigned": "true",
"add_offset": 220.0,
"coordinates": "day",
- "coordinate_system": "WGS84,EPSG:4326",
"description": "Daily Maximum Temperature",
"dimensions": "lon lat time",
"long_name": "tmmx",
@@ -1036,16 +1038,44 @@ def test_no_mask_and_scale(open_rasterio):
def test_mask_and_scale__to_raster(open_rasterio, tmp_path):
test_file = os.path.join(TEST_INPUT_DATA_DIR, "tmmx_20190121.nc")
tmp_output = tmp_path / "tmmx_20190121.tif"
- with pytest.warns(SerializationWarning):
- with open_rasterio(test_file, mask_and_scale=True) as rds:
- rds.air_temperature.rio.to_raster(str(tmp_output))
- with rasterio.open(str(tmp_output)) as riofh:
- assert riofh.scales == (0.1,)
- assert riofh.offsets == (220.0,)
- assert riofh.nodata == 32767.0
- data = riofh.read(1, masked=True)
- assert data.min() == 287
- assert data.max() == 821
+ with open_rasterio(test_file, mask_and_scale=True) as rds:
+ rds.air_temperature.rio.to_raster(str(tmp_output))
+ with rasterio.open(str(tmp_output)) as riofh:
+ assert riofh.scales == (0.1,)
+ assert riofh.offsets == (220.0,)
+ assert riofh.nodata == 32767.0
+ data = riofh.read(1, masked=True)
+ assert data.min() == 287
+ assert data.max() == 821
+
+
+def test_mask_and_scale__unicode(open_rasterio):
+ test_file = os.path.join(TEST_INPUT_DATA_DIR, "unicode.nc")
+ with open_rasterio(test_file, mask_and_scale=True) as rds:
+ assert np.nanmin(rds.LST.values) == np.float32(270.4925)
+ assert np.nanmax(rds.LST.values) == np.float32(276.6025)
+ test_encoding = dict(rds.LST.encoding)
+ assert test_encoding["_Unsigned"] == "true"
+ assert test_encoding["add_offset"] == 190
+ assert test_encoding["scale_factor"] == pytest.approx(0.0025)
+ assert test_encoding["_FillValue"] == 65535
+ assert test_encoding["dtype"] == "int16"
+ assert test_encoding["rasterio_dtype"] == "int16"
+
+
+def test_mask_and_scale__unicode__to_raster(open_rasterio, tmp_path):
+ tmp_output = tmp_path / "unicode.tif"
+ test_file = os.path.join(TEST_INPUT_DATA_DIR, "unicode.nc")
+ with open_rasterio(test_file, mask_and_scale=True) as rds:
+ rds.LST.rio.to_raster(str(tmp_output))
+ with rasterio.open(str(tmp_output)) as riofh:
+ assert riofh.scales == (pytest.approx(0.0025),)
+ assert riofh.offsets == (190,)
+ assert riofh.nodata == 65535
+ data = riofh.read(1, masked=True)
+ assert data.min() == 32197
+ assert data.max() == 34641
+ assert riofh.dtypes == ("uint16",)
def test_notgeoreferenced_warning(open_rasterio):
diff --git a/test/integration/test_integration_rioxarray.py b/test/integration/test_integration_rioxarray.py
index c62d3ba..ba099d8 100644
--- a/test/integration/test_integration_rioxarray.py
+++ b/test/integration/test_integration_rioxarray.py
@@ -1558,6 +1558,7 @@ def test_to_raster(
def test_to_raster_3d(open_method, windowed, write_lock, compute, tmpdir):
tmp_raster = tmpdir.join("planet_3d_raster.tif")
with open_method(os.path.join(TEST_INPUT_DATA_DIR, "PLANET_SCOPE_3D.nc")) as mda:
+ assert sorted(mda.coords) == ["spatial_ref", "time", "x", "y"]
xds = mda.green.fillna(mda.green.rio.encoded_nodata)
xds.rio._nodata = mda.green.rio.encoded_nodata
delayed = xds.rio.to_raster(
| to_raster() save function changes original data
# to_raster() function modifying original variable values on output
I added a reproducible script below and attached a link to the data.
#### Code Sample
```python
import rioxarray
import xarray as xr
import numpy as np
from pyproj import CRS
# Open data
fpath = "./2020/002/00/OR_ABI-L2-LSTM1-M6_G16_s20200020000291_e20200020000349_c20200020001006.nc"
ds_xarr = xr.open_dataset(fpath, decode_coords="all")
# Lets convert coords to latitude and longitude
cc = CRS.from_cf(ds_xarr.goes_imager_projection.attrs)
ds_xarr.rio.write_crs(cc.to_string(), inplace=True)
sat_height = ds_xarr.goes_imager_projection.attrs["perspective_point_height"]
ds_xarr['x'] = ds_xarr.x.values * sat_height
ds_xarr['y'] = ds_xarr.y.values * sat_height
ds_xarr4326 = ds_xarr.rio.reproject("epsg:4326")
# lets view the min and max values
print("original min value: ", np.nanmin(ds_xarr4326['LST'].data)) # 255.795
print("original max value:" , np.nanmax(ds_xarr4326['LST'].data)) # 287.8375
# Save as raster file
ds_xarr4326['LST'].rio.to_raster("./GOES16_LST.tif",driver="GTiff")
# Lets read in output file and view the min max values (why are these different than original data?)
outds = xr.open_dataset("./GOES16_LST.tif")
print("outds min value: ", np.nanmin(outds['band_data'].data)) # 108.08
print("outds maxvalue: ", np.nanmax(outds['band_data'].data)) # 271.91748
```
__test data location:__
https://github.com/arojas314/data-sharing/blob/main/OR_ABI-L2-LSTM1-M6_G16_s20200020000291_e20200020000349_c20200020001006.nc
#### Problem description
When saving the xarray as a raster (GeoTiff file), the original data values are modified.
See output for min and max values above for more insight.
Originally, min max values were [255.795, 287.8375]. After saving to .tif file, new min max values are [108.08, 271.91748].
#### Expected Output
#### Environment Information
- rioxarray version: `0.11.1`
- rasterio version: `1.2.10`
- GDAL version: (`3.4.3`)
- Python version: `3.10.5`
#### Installation method
- conda
#### Conda environment information (if you installed with conda):
<br/>
Environment (<code>conda list</code>):
<details>

</details>
| 0.0 | f23d3d44928272e560ca2bab65494331ed816139 | [
"test/integration/test_integration__io.py::test_open_rasterio_mask_chunk_clip"
]
| [
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-green-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue1-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:1blue-blue-None-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:../../test/test_data/input/PLANET_SCOPE_3D.nc:blue-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable5-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-group6-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-variable7-group7-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\":MODIS_Grid_2D:sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-None-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-MODIS_Grid_2D-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-blue-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-sur_refl_b01_1-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[HDF4_EOS:EOS_GRID:\"./modis/MOD09GQ.A2017290.h11v04.006.NRT.hdf\"://MODIS_Grid_2D://sur_refl_b01_1-None-gr-False]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-None-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-PRODUCT-True]",
"test/integration/test_integration__io.py::test_build_subdataset_filter[netcdf:S5P_NRTI_L2__NO2____20190513T181819_20190513T182319_08191_01_010301_20190513T185033.nc:/PRODUCT/tm5_constant_a-tm5_constant_a-/PRODUCT-True]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio]",
"test/integration/test_integration__io.py::test_open_variable_filter[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio]",
"test/integration/test_integration__io.py::test_open_group_filter__missing[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_serialization",
"test/integration/test_integration__io.py::test_utm",
"test/integration/test_integration__io.py::test_platecarree",
"test/integration/test_integration__io.py::test_notransform",
"test/integration/test_integration__io.py::test_indexing",
"test/integration/test_integration__io.py::test_caching",
"test/integration/test_integration__io.py::test_chunks",
"test/integration/test_integration__io.py::test_chunks_with_mask_and_scale",
"test/integration/test_integration__io.py::test_pickle_rasterio",
"test/integration/test_integration__io.py::test_ENVI_tags",
"test/integration/test_integration__io.py::test_no_mftime",
"test/integration/test_integration__io.py::test_rasterio_environment",
"test/integration/test_integration__io.py::test_rasterio_vrt",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_transform_and_size",
"test/integration/test_integration__io.py::test_rasterio_vrt_with_src_crs",
"test/integration/test_integration__io.py::test_rasterio_vrt_gcps",
"test/integration/test_integration__io.py::test_rasterio_vrt_gcps__data_exists",
"test/integration/test_integration__io.py::test_open_cog[True]",
"test/integration/test_integration__io.py::test_open_cog[False]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio]",
"test/integration/test_integration__io.py::test_notgeoreferenced_warning[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio]",
"test/integration/test_integration__io.py::test_nc_attr_loading__disable_decode_times[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_lockless",
"test/integration/test_integration__io.py::test_lock_true",
"test/integration/test_integration__io.py::test_non_rectilinear",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__load_coords[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio]",
"test/integration/test_integration__io.py::test_non_rectilinear__skip_parse_coordinates[open_rasterio_engine]",
"test/integration/test_integration__io.py::test_rotation_affine",
"test/integration/test_integration__io.py::test_reading_gcps",
"test/integration/test_integration__io.py::test_read_file_handle_with_dask",
"test/integration/test_integration__io.py::test_read_cint16_with_dask",
"test/integration/test_integration__io.py::test_read_ascii__from_bytesio",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_pad_box[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_pad_box[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__auto_expand[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_error[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__one_dimension_error[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__nodata_in_bounds",
"test/integration/test_integration_rioxarray.py::test_clip_box__reproject_bounds[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_clip_box__reproject_bounds[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_clip_box__reproject_bounds[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_clip_box__reproject_bounds[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_clip_box__reproject_bounds[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_box__antimeridian",
"test/integration/test_integration_rioxarray.py::test_clip_box__mising_crs",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[modis_clip3]",
"test/integration/test_integration_rioxarray.py::test_slice_xy[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func1-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func1-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func2-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func2-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio_engine-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_rasterio_engine-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func4-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func4-False]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func5-True]",
"test/integration/test_integration_rioxarray.py::test_clip_geojson[open_func5-False]",
"test/integration/test_integration_rioxarray.py::test_clip__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_clip_box__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_reproject__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_reproject_match__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_pad_box__non_geospatial",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_func3]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_transform_bounds[open_func5]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_reproject_with_shape[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_reproject_3d[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_reproject_3d[open_func1]",
"test/integration/test_integration_rioxarray.py::test_reproject_3d[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_reproject_3d[open_func3]",
"test/integration/test_integration_rioxarray.py::test_reproject__scalar_coord[open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_reproject__scalar_coord[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_reproject__gcps_kwargs",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_src_affine__single_point",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataset-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_dataarray-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_func3]",
"test/integration/test_integration_rioxarray.py::test_make_coords__calc_trans[open_rasterio_engine-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataset-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_dataarray-open_func4]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_dataset]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_rasterio]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_func2]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_make_coords__attr_trans[open_rasterio_engine-open_func4]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_veris",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_3d",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__nodata_filled[open_rasterio_engine]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__all_nodata[open_dataarray]",
"test/integration/test_integration_rioxarray.py::test_interpolate_na__all_nodata[open_dataset]",
"test/integration/test_integration_rioxarray.py::test_load_in_geographic_dimensions",
"test/integration/test_integration_rioxarray.py::test_geographic_reproject",
"test/integration/test_integration_rioxarray.py::test_geographic_reproject__missing_nodata",
"test/integration/test_integration_rioxarray.py::test_geographic_resample_integer",
"test/integration/test_integration_rioxarray.py::test_to_raster__custom_description__wrong",
"test/integration/test_integration_rioxarray.py::test_to_raster__dataset__different_crs",
"test/integration/test_integration_rioxarray.py::test_to_raster__dataset__different_nodata",
"test/integration/test_integration_rioxarray.py::test_missing_spatial_dimensions",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims",
"test/integration/test_integration_rioxarray.py::test_set_spatial_dims__missing",
"test/integration/test_integration_rioxarray.py::test_crs_empty_dataset",
"test/integration/test_integration_rioxarray.py::test_crs_setter",
"test/integration/test_integration_rioxarray.py::test_crs_setter__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__array__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__copy",
"test/integration/test_integration_rioxarray.py::test_crs_writer__dataset__inplace",
"test/integration/test_integration_rioxarray.py::test_crs_writer__missing",
"test/integration/test_integration_rioxarray.py::test_crs__dataset__different_crs",
"test/integration/test_integration_rioxarray.py::test_clip_missing_crs",
"test/integration/test_integration_rioxarray.py::test_reproject_missing_crs",
"test/integration/test_integration_rioxarray.py::test_reproject_resolution_and_shape_transform",
"test/integration/test_integration_rioxarray.py::test_reproject_transform_missing_shape",
"test/integration/test_integration_rioxarray.py::test_crs_get_custom",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset",
"test/integration/test_integration_rioxarray.py::test_crs_is_removed",
"test/integration/test_integration_rioxarray.py::test_write_crs_cf",
"test/integration/test_integration_rioxarray.py::test_write_crs_cf__disable_grid_mapping",
"test/integration/test_integration_rioxarray.py::test_write_crs__missing_geospatial_dims",
"test/integration/test_integration_rioxarray.py::test_read_crs_cf",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset__nonstandard_grid_mapping",
"test/integration/test_integration_rioxarray.py::test_get_crs_dataset__missing_grid_mapping_default",
"test/integration/test_integration_rioxarray.py::test_nodata_setter",
"test/integration/test_integration_rioxarray.py::test_nodata_setter__copy",
"test/integration/test_integration_rioxarray.py::test_write_nodata__array__copy",
"test/integration/test_integration_rioxarray.py::test_write_nodata__array__inplace",
"test/integration/test_integration_rioxarray.py::test_write_nodata__missing",
"test/integration/test_integration_rioxarray.py::test_write_nodata__remove",
"test/integration/test_integration_rioxarray.py::test_write_nodata__encoded",
"test/integration/test_integration_rioxarray.py::test_write_nodata__different_dtype[-1.1_0]",
"test/integration/test_integration_rioxarray.py::test_write_nodata__different_dtype[-1.1_1]",
"test/integration/test_integration_rioxarray.py::test_isel_window",
"test/integration/test_integration_rioxarray.py::test_isel_window_wpad",
"test/integration/test_integration_rioxarray.py::test_write_pyproj_crs_dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip_box__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_clip_box_array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_slice_xy_array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_reproject__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_reproject__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_interpolate_na__dataset",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_interpolate_na__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_nodata__array",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_isel_window",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_error_msg",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__standard_name",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__standard_name__projected",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_find_dims__axis",
"test/integration/test_integration_rioxarray.py::test_missing_crs_error_msg",
"test/integration/test_integration_rioxarray.py::test_missing_transform_bounds",
"test/integration/test_integration_rioxarray.py::test_missing_transform_resolution",
"test/integration/test_integration_rioxarray.py::test_write_transform__from_read",
"test/integration/test_integration_rioxarray.py::test_write_transform",
"test/integration/test_integration_rioxarray.py::test_write_read_transform__non_rectilinear",
"test/integration/test_integration_rioxarray.py::test_write_read_transform__non_rectilinear__rotation__warning",
"test/integration/test_integration_rioxarray.py::test_missing_transform",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__geographic",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__geographic__preserve_attrs",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__projected_ft",
"test/integration/test_integration_rioxarray.py::test_nonstandard_dims_write_coordinate_system__no_crs",
"test/integration/test_integration_rioxarray.py::test_grid_mapping__pre_existing[open_func0]",
"test/integration/test_integration_rioxarray.py::test_grid_mapping__change[open_func0]",
"test/integration/test_integration_rioxarray.py::test_grid_mapping_default",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs__missing_crs",
"test/integration/test_integration_rioxarray.py::test_estimate_utm_crs__out_of_bounds",
"test/integration/test_integration_rioxarray.py::test_interpolate_na_missing_nodata",
"test/integration/test_integration_rioxarray.py::test_rio_write_gcps",
"test/integration/test_integration_rioxarray.py::test_rio_get_gcps",
"test/integration/test_integration_rioxarray.py::test_reproject__gcps_file",
"test/integration/test_integration_rioxarray.py::test_bounds__ordered__dataarray",
"test/integration/test_integration_rioxarray.py::test_bounds__ordered__dataset"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-09-09 16:53:42+00:00 | apache-2.0 | 1,700 |
|
cosimoNigro__agnpy-151 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..76a69e5
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,18 @@
+repos:
+ # https://pycqa.github.io/isort/docs/configuration/black_compatibility.html#integration-with-pre-commit
+ - repo: https://github.com/pycqa/isort
+ rev: 5.12.0
+ hooks:
+ - id: isort
+ args: ["--profile", "black", "--filter-files"]
+ - repo: https://github.com/psf/black
+ rev: 22.6.0
+ hooks:
+ - id: black
+ # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html?highlight=other%20tools#flake8
+ - repo: https://github.com/PyCQA/flake8
+ rev: 4.0.1
+ hooks:
+ - id: flake8
+ exclude: experiments
+ args: ["--count", "--max-line-length=100", "--extend-ignore=E203,E712,W503"]
diff --git a/agnpy/emission_regions/blob.py b/agnpy/emission_regions/blob.py
index ab3aa0f..c6aec43 100644
--- a/agnpy/emission_regions/blob.py
+++ b/agnpy/emission_regions/blob.py
@@ -48,13 +48,15 @@ class Blob:
size of the array of electrons Lorentz factors
gamma_p_size : int
size of the array of protons Lorentz factors
+ cosmology : :class:`~astropy.cosmology.Cosmology`
+ (optional) cosmology used to convert the redshift in a distance,
+ see https://docs.astropy.org/en/stable/cosmology/index.html
"""
def __init__(
self,
R_b=1e16 * u.cm,
z=0.069,
- d_L=None,
delta_D=10,
Gamma=10,
B=1 * u.G,
@@ -63,11 +65,12 @@ class Blob:
xi=1.0,
gamma_e_size=200,
gamma_p_size=200,
+ cosmology=None
):
self.R_b = R_b.to("cm")
self.z = z
# if the luminosity distance is not specified, it will be computed from z
- self.d_L = Distance(z=self.z).cgs if d_L is None else d_L
+ self.d_L = Distance(z=self.z, cosmology=cosmology).cgs
self.delta_D = delta_D
self.Gamma = Gamma
self.B = B
diff --git a/environment.yml b/environment.yml
index ae24b1d..7a54a17 100644
--- a/environment.yml
+++ b/environment.yml
@@ -13,7 +13,7 @@ dependencies:
- pyyaml # needed to read astropy ecsv file
- matplotlib
- sherpa
+ - pre-commit
- pip:
- agnpy
- gammapy
-
| cosimoNigro/agnpy | b72c94fa5c205284e0e3ee7a37072f3ccfc97c7b | diff --git a/agnpy/tests/test_emission_regions.py b/agnpy/tests/test_emission_regions.py
index c9e6d64..bc7d43e 100644
--- a/agnpy/tests/test_emission_regions.py
+++ b/agnpy/tests/test_emission_regions.py
@@ -2,6 +2,7 @@
import numpy as np
import astropy.units as u
from astropy.constants import m_e, m_p
+from astropy.cosmology import Planck18
import pytest
from agnpy.spectra import PowerLaw, BrokenPowerLaw
from agnpy.emission_regions import Blob
@@ -39,9 +40,9 @@ class TestBlob:
# - automatically set d_L
blob = Blob(z=2.1)
assert u.isclose(blob.d_L, 5.21497473e28 * u.cm, atol=0 * u.cm, rtol=1e-3)
- # - set a different d_L, not computed from z
- d_L = 1.5e27 * u.cm
- blob = Blob(z=0.1, d_L=d_L)
+ # - change cosmology
+ blob = Blob(z=0.1, cosmology=Planck18)
+ d_L = 1.4682341e+27 * u.cm
assert u.isclose(blob.d_L, d_L, atol=0 * u.cm, rtol=1e-5)
def test_particles_spectra(self):
| d_L parameter in blob definition spoiling older code and examples
Hi @cosimoNigro
I realized that you added a possibility to set d_L independently in PR #138
https://github.com/cosimoNigro/agnpy/blob/b72c94fa5c205284e0e3ee7a37072f3ccfc97c7b/agnpy/emission_regions/blob.py#L56-L58
This is a bit of a nuisance for the old codes that specified blob parameters using position arguments.
What is worse it also makes some inconsistencies, namely the doc string with the list of arguments is not valid:
https://github.com/cosimoNigro/agnpy/blob/b72c94fa5c205284e0e3ee7a37072f3ccfc97c7b/agnpy/emission_regions/blob.py#L30-L33
and it also make the code from the examples not working:
https://agnpy.readthedocs.io/en/latest/synchrotron.html
because delta_D is interpretted as d_L
I see two possibilities:
1) move the extra parameter at the end of the parameter list (I would recommend to do it for all the parameters initialized to None)
or
2) go carefully through the docs and update all the blob definitions to R_b=R_b, z=z, ... etc. convention
I think 1) is much simpler.
In addition to this the doc string should be also updated.
| 0.0 | b72c94fa5c205284e0e3ee7a37072f3ccfc97c7b | [
"agnpy/tests/test_emission_regions.py::TestBlob::test_blob_properties"
]
| [
"agnpy/tests/test_emission_regions.py::TestBlob::test_particles_spectra",
"agnpy/tests/test_emission_regions.py::TestBlob::test_particles_densities",
"agnpy/tests/test_emission_regions.py::TestBlob::test_total_energies_powers"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2023-09-01 09:37:55+00:00 | bsd-3-clause | 1,701 |
|
couler-proj__couler-83 | diff --git a/couler/core/run_templates.py b/couler/core/run_templates.py
index 7596a38..b94d5b6 100644
--- a/couler/core/run_templates.py
+++ b/couler/core/run_templates.py
@@ -98,6 +98,7 @@ def run_container(
enable_ulogfs=True,
daemon=False,
volume_mounts=None,
+ working_dir=None,
):
"""
Generate an Argo container template. For example, the template whalesay
@@ -174,6 +175,7 @@ def run_container(
enable_ulogfs=enable_ulogfs,
daemon=daemon,
volume_mounts=volume_mounts,
+ working_dir=working_dir,
)
states.workflow.add_template(template)
diff --git a/couler/core/templates/container.py b/couler/core/templates/container.py
index fc5c158..e3569f0 100644
--- a/couler/core/templates/container.py
+++ b/couler/core/templates/container.py
@@ -41,6 +41,7 @@ class Container(Template):
enable_ulogfs=True,
daemon=False,
volume_mounts=None,
+ working_dir=None,
):
Template.__init__(
self,
@@ -61,6 +62,7 @@ class Container(Template):
self.resources = resources
self.image_pull_policy = image_pull_policy
self.volume_mounts = volume_mounts
+ self.working_dir = working_dir
def to_dict(self):
template = Template.to_dict(self)
@@ -159,6 +161,8 @@ class Container(Template):
container["volumeMounts"] = [
vm.to_dict() for vm in self.volume_mounts
]
+ if self.working_dir is not None:
+ container["workingDir"] = self.working_dir
return container
def _convert_args_to_input_parameters(self, args):
diff --git a/couler/core/utils.py b/couler/core/utils.py
index f7857d9..fd4dbb8 100644
--- a/couler/core/utils.py
+++ b/couler/core/utils.py
@@ -58,6 +58,8 @@ def invocation_location():
else:
func_name = argo_safe_name(stack[2][3])
line_number = stack[3][2]
+ if func_name == "<module>":
+ func_name = "module-" + _get_uuid()
return func_name, line_number
| couler-proj/couler | 0002c779f997aa7942c669c4355f0b487ee0a2ad | diff --git a/couler/tests/argo_test.py b/couler/tests/argo_test.py
index 2353cca..8e31ce1 100644
--- a/couler/tests/argo_test.py
+++ b/couler/tests/argo_test.py
@@ -76,6 +76,7 @@ class ArgoTest(unittest.TestCase):
command=["bash", "-c"],
step_name="A",
volume_mounts=[volume_mount],
+ working_dir="/mnt/src",
)
wf = couler.workflow_yaml()
@@ -84,6 +85,9 @@ class ArgoTest(unittest.TestCase):
wf["spec"]["templates"][1]["container"]["volumeMounts"][0],
volume_mount.to_dict(),
)
+ self.assertEqual(
+ wf["spec"]["templates"][1]["container"]["workingDir"], "/mnt/src"
+ )
couler._cleanup()
def test_run_container_with_workflow_volume(self):
@@ -157,10 +161,8 @@ class ArgoTest(unittest.TestCase):
self.assertTrue(
params["value"]
in [
- # Note that the "output-id-92" case is needed for
- # Python 3.8.
- '"{{workflow.outputs.parameters.output-id-113}}"',
- '"{{workflow.outputs.parameters.output-id-114}}"',
+ '"{{workflow.outputs.parameters.output-id-117}}"',
+ '"{{workflow.outputs.parameters.output-id-118}}"',
]
)
# Check input parameters for step B
| Add `WorkingDir` field when creating containers | 0.0 | 0002c779f997aa7942c669c4355f0b487ee0a2ad | [
"couler/tests/argo_test.py::ArgoTest::test_run_container_with_volume"
]
| [
"couler/tests/argo_test.py::ArgoTest::test_create_job",
"couler/tests/argo_test.py::ArgoTest::test_run_bash_script",
"couler/tests/argo_test.py::ArgoTest::test_run_container_with_dependency_implicit_params_passing",
"couler/tests/argo_test.py::ArgoTest::test_run_container_with_workflow_volume",
"couler/tests/argo_test.py::ArgoTest::test_run_default_script",
"couler/tests/argo_test.py::ArgoTest::test_run_job_with_dependency_implicit_params_passing_from_container",
"couler/tests/argo_test.py::ArgoTest::test_run_job_with_dependency_implicit_params_passing_from_job",
"couler/tests/argo_test.py::ArgoTest::test_run_none_source",
"couler/tests/argo_test.py::ArgoTest::test_run_python_script",
"couler/tests/argo_test.py::ArgoTest::test_set_dependencies_with_exit_handler"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-10-12 20:40:00+00:00 | apache-2.0 | 1,702 |
|
couler-proj__couler-89 | diff --git a/couler/core/run_templates.py b/couler/core/run_templates.py
index b94d5b6..35a08b4 100644
--- a/couler/core/run_templates.py
+++ b/couler/core/run_templates.py
@@ -99,6 +99,7 @@ def run_container(
daemon=False,
volume_mounts=None,
working_dir=None,
+ node_selector=None,
):
"""
Generate an Argo container template. For example, the template whalesay
@@ -176,6 +177,7 @@ def run_container(
daemon=daemon,
volume_mounts=volume_mounts,
working_dir=working_dir,
+ node_selector=node_selector,
)
states.workflow.add_template(template)
diff --git a/couler/core/templates/container.py b/couler/core/templates/container.py
index e3569f0..c73a489 100644
--- a/couler/core/templates/container.py
+++ b/couler/core/templates/container.py
@@ -42,6 +42,7 @@ class Container(Template):
daemon=False,
volume_mounts=None,
working_dir=None,
+ node_selector=None,
):
Template.__init__(
self,
@@ -63,6 +64,7 @@ class Container(Template):
self.image_pull_policy = image_pull_policy
self.volume_mounts = volume_mounts
self.working_dir = working_dir
+ self.node_selector = node_selector
def to_dict(self):
template = Template.to_dict(self)
@@ -108,6 +110,11 @@ class Container(Template):
template["inputs"]["artifacts"] = _input_list
+ # Node selector
+ if self.node_selector is not None:
+ # TODO: Support inferring node selector values from Argo parameters
+ template["nodeSelector"] = self.node_selector
+
# Container
if not utils.gpu_requested(self.resources):
if self.env is None:
| couler-proj/couler | c51142ebf2af3945abfbea30f5b50e8860687d3b | diff --git a/couler/tests/argo_test.py b/couler/tests/argo_test.py
index 8e31ce1..8b4d925 100644
--- a/couler/tests/argo_test.py
+++ b/couler/tests/argo_test.py
@@ -90,6 +90,22 @@ class ArgoTest(unittest.TestCase):
)
couler._cleanup()
+ def test_run_container_with_node_selector(self):
+ couler.run_container(
+ image="docker/whalesay:latest",
+ args=["echo -n hello world"],
+ command=["bash", "-c"],
+ step_name="A",
+ node_selector={"beta.kubernetes.io/arch": "amd64"},
+ )
+
+ wf = couler.workflow_yaml()
+ self.assertEqual(
+ wf["spec"]["templates"][1]["nodeSelector"],
+ {"beta.kubernetes.io/arch": "amd64"},
+ )
+ couler._cleanup()
+
def test_run_container_with_workflow_volume(self):
pvc = VolumeClaimTemplate("workdir")
volume_mount = VolumeMount("workdir", "/mnt/vol")
@@ -161,8 +177,8 @@ class ArgoTest(unittest.TestCase):
self.assertTrue(
params["value"]
in [
- '"{{workflow.outputs.parameters.output-id-117}}"',
- '"{{workflow.outputs.parameters.output-id-118}}"',
+ '"{{workflow.outputs.parameters.output-id-133}}"',
+ '"{{workflow.outputs.parameters.output-id-134}}"',
]
)
# Check input parameters for step B
| Support node selector for scheduling pods
An example in Argo Workflows: https://github.com/argoproj/argo/blob/master/examples/node-selector.yaml
cc @inohmonton99 | 0.0 | c51142ebf2af3945abfbea30f5b50e8860687d3b | [
"couler/tests/argo_test.py::ArgoTest::test_run_container_with_node_selector"
]
| [
"couler/tests/argo_test.py::ArgoTest::test_create_job",
"couler/tests/argo_test.py::ArgoTest::test_run_bash_script",
"couler/tests/argo_test.py::ArgoTest::test_run_container_with_dependency_implicit_params_passing",
"couler/tests/argo_test.py::ArgoTest::test_run_container_with_volume",
"couler/tests/argo_test.py::ArgoTest::test_run_container_with_workflow_volume",
"couler/tests/argo_test.py::ArgoTest::test_run_default_script",
"couler/tests/argo_test.py::ArgoTest::test_run_job_with_dependency_implicit_params_passing_from_container",
"couler/tests/argo_test.py::ArgoTest::test_run_job_with_dependency_implicit_params_passing_from_job",
"couler/tests/argo_test.py::ArgoTest::test_run_none_source",
"couler/tests/argo_test.py::ArgoTest::test_run_python_script",
"couler/tests/argo_test.py::ArgoTest::test_set_dependencies_with_exit_handler"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-10-15 14:40:49+00:00 | apache-2.0 | 1,703 |
|
coverahealth__dataspec-15 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9629beb..cf8c599 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add conforming string formats (#3)
- Add ISO time string format (#4)
- Allow type-checking specs to be created by passing a type directly to `s` (#12)
+- Add email address string format (#6)
## [0.1.0] - 2019-10-20
### Added
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index 7f5e005..35e5e0a 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -3,6 +3,7 @@ import sys
import threading
import uuid
from datetime import date, datetime, time
+from email.headerregistry import Address
from typing import (
Any,
Callable,
@@ -374,6 +375,18 @@ def register_str_format(
return create_str_format
+@register_str_format("email")
+def _str_is_email_address(s: str) -> Iterator[ErrorDetails]:
+ try:
+ Address(addr_spec=s)
+ except (TypeError, ValueError) as e:
+ yield ErrorDetails(
+ f"String does not contain a valid email address: {e}",
+ pred=_str_is_email_address,
+ value=s,
+ )
+
+
@register_str_format("uuid", conformer=uuid.UUID)
def _str_is_uuid(s: str) -> Iterator[ErrorDetails]:
try:
| coverahealth/dataspec | b314d36fab96cb63477c1d95c734e3bd0f807ed5 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index 84b2b23..3f368a8 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -652,6 +652,60 @@ class TestStringSpecValidation:
def test_is_not_zipcode(self, zipcode_spec: Spec, v):
assert not zipcode_spec.is_valid(v)
+ @pytest.mark.parametrize(
+ "opts",
+ [
+ {"regex": r"\d{5}(-\d{4})?", "format_": "uuid"},
+ {"regex": r"\d{5}(-\d{4})?", "conform_format": "uuid"},
+ {"conform_format": "uuid", "format_": "uuid"},
+ ],
+ )
+ def test_regex_and_format_agreement(self, opts):
+ with pytest.raises(ValueError):
+ s.str(**opts)
+
+
+class TestStringFormatValidation:
+ class TestEmailFormat:
+ @pytest.fixture
+ def email_spec(self) -> Spec:
+ return s.str(format_="email")
+
+ @pytest.mark.parametrize(
+ "v",
+ [
+ "chris@localhost",
+ "[email protected]",
+ "[email protected]",
+ "[email protected]",
+ ],
+ )
+ def test_is_email_str(self, email_spec: Spec, v):
+ assert email_spec.is_valid(v)
+
+ @pytest.mark.parametrize(
+ "v",
+ [
+ None,
+ 25,
+ 3.14,
+ [],
+ set(),
+ "abcdef",
+ "abcdefg",
+ "100017",
+ "10017-383",
+ "1945-9-2",
+ "430-10-02",
+ "chris",
+ "chris@",
+ "@gmail",
+ "@gmail.com",
+ ],
+ )
+ def test_is_not_email_str(self, email_spec: Spec, v):
+ assert not email_spec.is_valid(v)
+
class TestISODateFormat:
@pytest.fixture
def conform(self):
@@ -849,18 +903,6 @@ class TestStringSpecValidation:
assert not uuid_spec.is_valid(v)
assert not conforming_uuid_spec.is_valid(v)
- @pytest.mark.parametrize(
- "opts",
- [
- {"regex": r"\d{5}(-\d{4})?", "format_": "uuid"},
- {"regex": r"\d{5}(-\d{4})?", "conform_format": "uuid"},
- {"conform_format": "uuid", "format_": "uuid"},
- ],
- )
- def test_regex_and_format_agreement(self, opts):
- with pytest.raises(ValueError):
- s.str(**opts)
-
class TestUUIDSpecValidation:
@pytest.mark.parametrize(
| Support email address string format
Applications commonly need to validate that an email address is at least in a valid format. Python features the [`email.headerregistry.Address`](https://docs.python.org/3/library/email.headerregistry.html#email.headerregistry.Address) object which parses email address strings and can provide some reasonable hints about formatting errors. It may not be foolproof, but for common cases it is probably sufficient. | 0.0 | b314d36fab96cb63477c1d95c734e3bd0f807ed5 | [
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[chris@localhost]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[chris]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[chris@]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[@gmail]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[@gmail.com]"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::test_any",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::test_nilable",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2019-10-24 02:08:17+00:00 | mit | 1,704 |
|
coverahealth__dataspec-20 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5751826..8f7b79b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add ISO time string format (#4)
- Allow type-checking specs to be created by passing a type directly to `s` (#12)
- Add email address string format (#6)
+- Add URL string format factory `s.url` (#16)
### Fixed
- Guard against `inspect.signature` failures with Python builtins (#18)
diff --git a/src/dataspec/api.py b/src/dataspec/api.py
index 924f027..5673c9e 100644
--- a/src/dataspec/api.py
+++ b/src/dataspec/api.py
@@ -23,6 +23,7 @@ from dataspec.factories import (
opt_key,
str_spec,
time_spec,
+ url_str_spec,
uuid_spec,
)
@@ -97,6 +98,7 @@ class SpecAPI:
obj = staticmethod(obj_spec)
str = staticmethod(str_spec)
time = staticmethod(time_spec)
+ url = staticmethod(url_str_spec)
uuid = staticmethod(uuid_spec)
# Builtin pre-baked specs
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index 35e5e0a..3092dac 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -19,6 +19,7 @@ from typing import (
Union,
cast,
)
+from urllib.parse import ParseResult, parse_qs, urlparse
import attr
@@ -381,7 +382,7 @@ def _str_is_email_address(s: str) -> Iterator[ErrorDetails]:
Address(addr_spec=s)
except (TypeError, ValueError) as e:
yield ErrorDetails(
- f"String does not contain a valid email address: {e}",
+ message=f"String does not contain a valid email address: {e}",
pred=_str_is_email_address,
value=s,
)
@@ -554,6 +555,224 @@ def str_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
return ValidatorSpec.from_validators(tag or "str", *validators, conformer=conformer)
+_IGNORE_URL_PARAM = object()
+_URL_RESULT_FIELDS = frozenset(
+ {
+ "scheme",
+ "netloc",
+ "path",
+ "params",
+ "fragment",
+ "username",
+ "password",
+ "hostname",
+ "port",
+ }
+)
+
+
+def _url_attr_validator(
+ attr: str, exact_attr: Any, regex_attr: Any, in_attr: Any
+) -> Optional[ValidatorFn]:
+ """Return a urllib.parse.ParseResult attribute validator function for the given
+ attribute based on the values of the three rule types."""
+
+ def get_url_attr(v: Any, attr: str = attr) -> Any:
+ return getattr(v, attr)
+
+ if exact_attr is not _IGNORE_URL_PARAM:
+
+ @pred_to_validator(
+ f"URL attribute '{attr}' value '{{value}}' is not '{exact_attr}'",
+ complement=True,
+ convert_value=get_url_attr,
+ )
+ def url_attr_equals(v: Any) -> bool:
+ return get_url_attr(v) == exact_attr
+
+ return url_attr_equals
+
+ elif regex_attr is not _IGNORE_URL_PARAM:
+
+ if attr == "port":
+ raise ValueError(f"Cannot define regex spec for URL attribute 'port'")
+
+ if not isinstance(regex_attr, str):
+ raise TypeError(f"URL attribute '{attr}_regex' must be a string value")
+
+ pattern = re.compile(regex_attr)
+
+ @pred_to_validator(
+ f"URL attribute '{attr}' value '{{value}}' does not "
+ f"match regex '{regex_attr}'",
+ complement=True,
+ convert_value=get_url_attr,
+ )
+ def url_attr_matches_regex(v: ParseResult) -> bool:
+ return bool(re.fullmatch(pattern, get_url_attr(v)))
+
+ return url_attr_matches_regex
+
+ elif in_attr is not _IGNORE_URL_PARAM:
+
+ if not isinstance(in_attr, (frozenset, set)):
+ raise TypeError(f"URL attribute '{attr}_in' must be set or frozenset")
+
+ @pred_to_validator(
+ f"URL attribute '{attr}' value '{{value}}' not in {in_attr}",
+ complement=True,
+ convert_value=get_url_attr,
+ )
+ def url_attr_is_allowed_value(v: ParseResult) -> bool:
+ return get_url_attr(v) in in_attr
+
+ return url_attr_is_allowed_value
+ else:
+ return None
+
+
+def url_str_spec(
+ tag: Optional[Tag] = None,
+ query: Optional[SpecPredicate] = None,
+ conformer: Optional[Conformer] = None,
+ **kwargs,
+) -> Spec:
+ """
+ Return a spec that can validate URLs against common rules.
+
+ URL string specs always verify that input values are strings and that they can
+ be successfully parsed by :py:func:`urllib.parse.urlparse`.
+
+ URL specs can specify a new or existing Spec or spec predicate value to validate
+ the query string value produced by calling :py:func:`urllib.parse.parse_qs` on the
+ :py:attr:`urllib.parse.ParseResult.query` attribute of the parsed URL result.
+
+ Other restrictions can be applied by passing any one of three different keyword
+ arguments for any of the fields (excluding :py:attr:`urllib.parse.ParseResult.query`)
+ of :py:class:`urllib.parse.ParseResult`. For example, to specify restrictions on the
+ ``hostname`` field, you could use the following keywords:
+
+ * ``hostname`` accepts any value (including :py:obj:`None`) and checks for an
+ exact match of the keyword argument value
+ * ``hostname_in`` takes a :py:class:``set`` or :py:class:``frozenset`` and
+ validates that the `hostname`` field is an exact match with one of the
+ elements of the set
+ * ``hostname_regex`` takes a :py:class:``str``, creates a Regex pattern from
+ that string, and validates that ``hostname`` is a match (by
+ :py:func:`re.fullmatch`) with the given pattern
+
+ The value :py:obj:`None` can be used for comparison in all cases. Note that default
+ the values for fields of :py:class:`urllib.parse.ParseResult` vary by field, so
+ using None may produce unexpected results.
+
+ At most only one restriction can be applied to any given field for the
+ :py:class:`urllib.parse.ParseResult`. Specifying more than one restriction for
+ a field will produce a :py:exc:`ValueError`.
+
+ At least one restriction must be specified to create a URL string Spec.
+ Attempting to create a URL Spec without specifying a restriction will produce a
+ :py:exc:`ValueError`.
+
+ :param tag: an optional tag for the resulting spec
+ :param query: an optional spec for the :py:class:`dict` created by calling
+ :py:func:`urllib.parse.parse_qs` on the :py:attr:`urllib.parse.ParseResult.query`
+ attribute of the parsed URL
+ :param scheme: if specified, require an exact match for ``scheme``
+ :param scheme_in: if specified, require ``scheme`` to match at least one value in the set
+ :param schema_regex: if specified, require ``scheme`` to match the regex pattern
+ :param netloc: if specified, require an exact match for ``netloc``
+ :param netloc_in: if specified, require ``netloc`` to match at least one value in the set
+ :param netloc_regex: if specified, require ``netloc`` to match the regex pattern
+ :param path: if specified, require an exact match for ``path``
+ :param path_in: if specified, require ``path`` to match at least one value in the set
+ :param path_regex: if specified, require ``path`` to match the regex pattern
+ :param params: if specified, require an exact match for ``params``
+ :param params_in: if specified, require ``params`` to match at least one value in the set
+ :param params_regex: if specified, require ``params`` to match the regex pattern
+ :param fragment: if specified, require an exact match for ``fragment``
+ :param fragment_in: if specified, require ``fragment`` to match at least one value in the set
+ :param fragment_regex: if specified, require ``fragment`` to match the regex pattern
+ :param username: if specified, require an exact match for ``username``
+ :param username_in: if specified, require ``username`` to match at least one value in the set
+ :param username_regex: if specified, require ``username`` to match the regex pattern
+ :param password: if specified, require an exact match for ``password``
+ :param password_in: if specified, require ``password`` to match at least one value in the set
+ :param password_regex: if specified, require ``password`` to match the regex pattern
+ :param hostname: if specified, require an exact match for ``hostname``
+ :param hostname_in: if specified, require ``hostname`` to match at least one value in the set
+ :param hostname_regex: if specified, require ``hostname`` to match the regex pattern
+ :param port: if specified, require an exact match for ``port``
+ :param port_in: if specified, require ``port`` to match at least one value in the set
+ :param conformer: an optional conformer for the value
+ :return: a Spec which can validate that a string contains a URL
+ """
+
+ @pred_to_validator(f"Value '{{value}}' is not a string", complement=True)
+ def is_str(s: Any) -> bool:
+ return isinstance(s, str)
+
+ validators: List[Union[ValidatorFn, ValidatorSpec]] = [is_str]
+
+ child_validators = []
+ for url_attr in _URL_RESULT_FIELDS:
+ in_attr = kwargs.pop(f"{url_attr}_in", _IGNORE_URL_PARAM)
+ regex_attr = kwargs.pop(f"{url_attr}_regex", _IGNORE_URL_PARAM)
+ exact_attr = kwargs.pop(f"{url_attr}", _IGNORE_URL_PARAM)
+
+ if (
+ sum(
+ int(v is not _IGNORE_URL_PARAM)
+ for v in [in_attr, regex_attr, exact_attr]
+ )
+ > 1
+ ):
+ raise ValueError(
+ f"URL specs may only specify one of {url_attr}, "
+ f"{url_attr}_in, and {url_attr}_regex for any URL attribute"
+ )
+
+ attr_validator = _url_attr_validator(url_attr, exact_attr, regex_attr, in_attr)
+ if attr_validator is not None:
+ child_validators.append(attr_validator)
+
+ if query is not None:
+ query_spec: Optional[Spec] = make_spec(query)
+ else:
+ query_spec = None
+
+ if kwargs:
+ raise ValueError(f"Unused keyword arguments: {kwargs}")
+
+ if query_spec is None and not child_validators:
+ raise ValueError(f"URL specs must include at least one validation rule")
+
+ def validate_parse_result(v: ParseResult) -> Iterator[ErrorDetails]:
+ for validate in child_validators:
+ yield from validate(v)
+
+ if query_spec is not None:
+ query_dict = parse_qs(v.query)
+ yield from query_spec.validate(query_dict)
+
+ def validate_url(s: str) -> Iterator[ErrorDetails]:
+ try:
+ url = urlparse(s)
+ except ValueError as e:
+ yield ErrorDetails(
+ message=f"String does not contain a valid URL: {e}",
+ pred=validate_url,
+ value=s,
+ )
+ else:
+ yield from validate_parse_result(url)
+
+ validators.append(validate_url)
+
+ return ValidatorSpec.from_validators(
+ tag or "url_str", *validators, conformer=conformer
+ )
+
+
def uuid_spec(
tag: Optional[Tag] = None,
versions: Optional[Set[int]] = None,
| coverahealth/dataspec | 59d81c6b0d23480f866c7661bfa23d02fc2f6b4d | diff --git a/tests/test_factories.py b/tests/test_factories.py
index 3f368a8..dc141ce 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -904,6 +904,132 @@ class TestStringFormatValidation:
assert not conforming_uuid_spec.is_valid(v)
+class TestURLSpecValidation:
+ @pytest.mark.parametrize(
+ "spec_kwargs",
+ [
+ {},
+ {"host": "coverahealth.com"},
+ {
+ "hostname": "coverahealth.com",
+ "hostname_regex": r"(api\.)?coverahealth.com",
+ },
+ {"port_regex": r"80|443"},
+ ],
+ )
+ def test_invalid_url_specs(self, spec_kwargs):
+ with pytest.raises(ValueError):
+ s.url(**spec_kwargs)
+
+ @pytest.mark.parametrize(
+ "spec_kwargs", [{"hostname_regex": b"coverahealth.com"}, {"port_in": [80, 443]}]
+ )
+ def test_invalid_url_spec_argument_types(self, spec_kwargs):
+ with pytest.raises(TypeError):
+ s.url(**spec_kwargs)
+
+ @pytest.mark.parametrize(
+ "v", [None, 25, 3.14, {}, [], set(), (), "", "//[coverahealth.com"]
+ )
+ def test_invalid_url(self, v):
+ assert not s.url(hostname_regex=r".*").is_valid(v)
+
+ @pytest.fixture
+ def urlstr(self) -> str:
+ return (
+ "https://jdoe:[email protected]:80/v1/patients"
+ "?last-name=Smith&last-name=Doe&birth-year=1985#user-profile"
+ )
+
+ def test_valid_query_str(self, urlstr):
+ assert s.url(
+ query={
+ "last-name": [s.all(s.str(), str.istitle)],
+ "birth-year": [s.str(regex=r"\d{4}")],
+ }
+ ).is_valid(urlstr)
+
+ def test_invalid_query_str(self, urlstr):
+ assert not s.url(
+ query={
+ "last-name": [s.str(), {"count": 1}],
+ "birth-year": [s.str(regex=r"\d{4}")],
+ }
+ ).is_valid(urlstr)
+
+ @pytest.mark.parametrize(
+ "spec_kwargs",
+ [
+ {"scheme": "https"},
+ {"scheme_in": {"https", "http"}},
+ {"scheme_regex": r"https?"},
+ {"netloc": "jdoe:[email protected]:80"},
+ {
+ "netloc_in": {
+ "jdoe:[email protected]:80",
+ "jdoe:[email protected]:443",
+ }
+ },
+ {"netloc_regex": r"jdoe:securepass@api\.coverahealth\.com:(80|443)"},
+ {"path": "/v1/patients"},
+ {"path_in": {"/v1/patients", "/v2/patients"}},
+ {"path_regex": r"\/(v1|v2)\/patients"},
+ {"fragment": "user-profile"},
+ {"fragment_in": {"user-profile", "user-addresses"}},
+ {"fragment_regex": r"user\-(profile|addresses)"},
+ {"username": "jdoe"},
+ {"username_in": {"jdoe", "doej"}},
+ {"username_regex": r"jdoe"},
+ {"password": "securepass"},
+ {"password_in": {"securepass", "insecurepass"}},
+ {"password_regex": r"(in)?securepass"},
+ {"hostname": "api.coverahealth.com"},
+ {"hostname_in": {"coverahealth.com", "api.coverahealth.com"}},
+ {"hostname_regex": r"(api\.)?coverahealth\.com"},
+ {"port": 80},
+ {"port_in": {80, 443}},
+ ],
+ )
+ def test_is_url_str(self, urlstr: str, spec_kwargs):
+ assert s.url(**spec_kwargs).is_valid(urlstr)
+
+ @pytest.mark.parametrize(
+ "spec_kwargs",
+ [
+ {"scheme": "http"},
+ {"scheme_in": {"http", "ftp"}},
+ {"scheme_regex": r"(ht|f)tp"},
+ {"netloc": "carl:[email protected]:80"},
+ {
+ "netloc_in": {
+ "carl:[email protected]:80",
+ "carl:[email protected]:443",
+ }
+ },
+ {"netloc_regex": r"carl:insecurepass@api\.coverahealth\.com:(80|443)"},
+ {"path": "/v2/patients"},
+ {"path_in": {"/v2/patients", "/v3/patients"}},
+ {"path_regex": r"\/(v2|v3)\/patients"},
+ {"fragment": "user-addresses"},
+ {"fragment_in": {"user-phone-numbers", "user-addresses"}},
+ {"fragment_regex": r"user\-(phone\-numbers|addresses)"},
+ {"username": "carl"},
+ {"username_in": {"carl", "vic"}},
+ {"username_regex": r"(carl|vic)"},
+ {"password": "insecurepass"},
+ {"password_in": {"rlysecurepass", "insecurepass"}},
+ {"password_regex": r"(rly|in)securepass"},
+ {"hostname": "coverahealth.com"},
+ {"hostname_in": {"coverahealth.com", "data.coverahealth.com"}},
+ {"hostname_regex": r"(data\.)?coverahealth\.com"},
+ {"port": 21},
+ {"port_in": {21, 443}},
+ ],
+ )
+ def test_is_not_url_str(self, urlstr: str, spec_kwargs):
+ assert not s.url(**spec_kwargs).is_valid(urlstr)
+
+
class TestUUIDSpecValidation:
@pytest.mark.parametrize(
"v",
| Create URL string validator factory
In #8, we will add a `s.str(format_="url")` string format to check that a string contains something which can be considered a URL. However, nearly any string can be considered a valid URL, so this is not terribly useful outside of limited cases. I think it would be more useful to add a full `s.url_str(...)` factory, which can check any of the useful components of a URL (e.g. asserting that URLs are using a certain scheme or are constrained to a certain subset of hosts). | 0.0 | 59d81c6b0d23480f866c7661bfa23d02fc2f6b4d | [
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::test_any",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::test_nilable",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[chris@localhost]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[chris]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[chris@]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[@gmail]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[@gmail.com]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_issue_reference",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-10-25 01:02:25+00:00 | mit | 1,705 |
|
coverahealth__dataspec-21 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8f7b79b..58388aa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow type-checking specs to be created by passing a type directly to `s` (#12)
- Add email address string format (#6)
- Add URL string format factory `s.url` (#16)
+- Add Python `dateutil` support for parsing dates (#5)
### Fixed
- Guard against `inspect.signature` failures with Python builtins (#18)
diff --git a/Makefile b/Makefile
index 48451e6..26776a6 100644
--- a/Makefile
+++ b/Makefile
@@ -23,5 +23,5 @@ format:
.PHONY: test
test:
- @rm .coverage*
- @tox -e py36,py37,py38,format,mypy,lint -p 4
+ @rm -f .coverage*
+ @TOX_SKIP_ENV=coverage tox -p 4
diff --git a/requirements.txt b/requirements.txt
index 53e9897..75cc9c9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,1 +1,2 @@
attrs>=19.1.0
+python-dateutil
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 25c9e91..69154c0 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ VERSION = None
REQUIRED = ["attrs"]
-EXTRAS = {}
+EXTRAS = {"dates": ["python-dateutil"]}
# Copied from the excellent https://github.com/kennethreitz/setup.py
diff --git a/src/dataspec/api.py b/src/dataspec/api.py
index 5673c9e..8ffe3e6 100644
--- a/src/dataspec/api.py
+++ b/src/dataspec/api.py
@@ -121,5 +121,13 @@ class SpecAPI:
fdef = staticmethod(_fdef)
opt = staticmethod(opt_key)
+ # Conditionally available spec factories
+ try:
+ from dataspec.factories import datetime_str_spec
+ except ImportError:
+ pass
+ else:
+ inst_str = staticmethod(datetime_str_spec)
+
s = SpecAPI()
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index 3092dac..4f27d06 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -262,6 +262,81 @@ datetime_spec = _make_datetime_spec_factory(datetime)
date_spec = _make_datetime_spec_factory(date)
time_spec = _make_datetime_spec_factory(time)
+try:
+ from dateutil.parser import parse as parse_date, isoparse as parse_isodate
+except ImportError:
+ pass
+else:
+
+ def datetime_str_spec( # pylint: disable=too-many-arguments
+ tag: Optional[Tag] = None,
+ iso_only: bool = False,
+ before: Optional[datetime] = None,
+ after: Optional[datetime] = None,
+ is_aware: Optional[bool] = None,
+ conformer: Optional[Conformer] = None,
+ ) -> Spec:
+ """
+ Return a Spec that validates strings containing date/time strings in
+ most common formats.
+
+ The resulting Spec will validate that the input value is a string which
+ contains a date/time using :py:func:`dateutil.parser.parse`. If the input
+ value can be determined to contain a valid :py:class:`datetime.datetime`
+ instance, it will be validated against a datetime Spec as by a standard
+ ``dataspec`` datetime Spec using the keyword options below.
+
+ :py:func:`dateutil.parser.parse` cannot produce :py:class:`datetime.time`
+ or :py:class:`datetime.date` instances directly, so this method will only
+ produce :py:func:`datetime.datetime` instances even if the input string
+ contains only a valid time or date, but not both.
+
+ If ``iso_only`` keyword argument is ``True``, restrict the set of allowed
+ input values to strings which contain ISO 8601 formatted strings. This is
+ accomplished using :py:func:`dateutil.parser.isoparse`, which does not
+ guarantee strict adherence to the ISO 8601 standard, but accepts a wider
+ range of valid ISO 8601 strings than Python 3.7+'s
+ :py:func:`datetime.datetime.fromisoformat` function.
+
+ :param tag: an optional tag for the resulting spec
+ :param iso_only: if True, restrict the set of allowed date strings to those
+ formatted as ISO 8601 datetime strings; default is False
+ :param before: if specified, a datetime that specifies the latest instant
+ this Spec will validate
+ :param after: if specified, a datetime that specifies the earliest instant
+ this Spec will validate
+ :param bool is_aware: if specified, indicate whether the Spec will validate
+ either aware or naive :py:class:`datetime.datetime` instances.
+ :param conformer: an optional conformer for the value; if one is not provided
+ :py:func:`dateutil.parser.parse` will be used
+ :return: a Spec which validates strings containing date/time strings
+ """
+
+ tag = tag or "datetime_str"
+
+ @pred_to_validator(f"Value '{{value}}' is not type 'str'", complement=True)
+ def is_str(x: Any) -> bool:
+ return isinstance(x, str)
+
+ dt_spec = datetime_spec(before=before, after=after, is_aware=is_aware)
+ parse_date_str = parse_isodate if iso_only else parse_date
+
+ def str_contains_datetime(s: str) -> Iterator[ErrorDetails]:
+ try:
+ parsed_dt = parse_date_str(s) # type: ignore
+ except (OverflowError, ValueError):
+ yield ErrorDetails(
+ message=f"String '{s}' does not contain a datetime",
+ pred=str_contains_datetime,
+ value=s,
+ )
+ else:
+ yield from dt_spec.validate(parsed_dt)
+
+ return ValidatorSpec.from_validators(
+ tag, is_str, str_contains_datetime, conformer=conformer or parse_date
+ )
+
def nilable_spec(
*args: Union[Tag, SpecPredicate], conformer: Optional[Conformer] = None
diff --git a/tox.ini b/tox.ini
index 4617193..d4d31c7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,9 +1,10 @@
[tox]
-envlist = py36,py37,py38,coverage,format,mypy,lint,safety
+envlist = {py36,py37,py38}{-dateutil,},coverage,format,mypy,lint,safety
[testenv]
deps =
coverage
+ dateutil: python-dateutil
pytest
commands =
coverage run \
| coverahealth/dataspec | 10e8d508329849446ee5c630888be4e4db5f52e4 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index dc141ce..1f5fd9a 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -7,6 +7,11 @@ import pytest
from dataspec import INVALID, Spec, s
+try:
+ from dateutil.parser import parse as parse_date
+except ImportError:
+ parse_date = None
+
class TestAllSpecValidation:
@pytest.fixture
@@ -369,7 +374,7 @@ class TestDateSpecValidation:
assert not after_spec.is_valid(v)
class TestIsAwareSpec:
- def test_aware_spec(self) -> Spec:
+ def test_aware_spec(self):
s.date(is_aware=False)
with pytest.raises(TypeError):
@@ -466,6 +471,110 @@ class TestTimeSpecValidation:
assert not aware_spec.is_valid(time())
[email protected](parse_date is None, reason="python-dateutil must be installed")
+class TestInstStringSpecValidation:
+ ISO_DATETIMES = [
+ ("2003-09-25T10:49:41", datetime(2003, 9, 25, 10, 49, 41)),
+ ("2003-09-25T10:49", datetime(2003, 9, 25, 10, 49)),
+ ("2003-09-25T10", datetime(2003, 9, 25, 10)),
+ ("2003-09-25", datetime(2003, 9, 25)),
+ ("20030925T104941", datetime(2003, 9, 25, 10, 49, 41)),
+ ("20030925T1049", datetime(2003, 9, 25, 10, 49, 0)),
+ ("20030925T10", datetime(2003, 9, 25, 10)),
+ ("20030925", datetime(2003, 9, 25)),
+ ("2003-09-25 10:49:41,502", datetime(2003, 9, 25, 10, 49, 41, 502000)),
+ ("19760704", datetime(1976, 7, 4)),
+ ("0099-01-01T00:00:00", datetime(99, 1, 1, 0, 0)),
+ ("0031-01-01T00:00:00", datetime(31, 1, 1, 0, 0)),
+ ("20080227T21:26:01.123456789", datetime(2008, 2, 27, 21, 26, 1, 123456)),
+ ("0003-03-04", datetime(3, 3, 4)),
+ ("950404 122212", datetime(1995, 4, 4, 12, 22, 12)),
+ ]
+ NON_ISO_DATETIMES = [
+ ("Thu Sep 25 10:36:28 2003", datetime(2003, 9, 25, 10, 36, 28)),
+ ("Thu Sep 25 2003", datetime(2003, 9, 25)),
+ ("199709020908", datetime(1997, 9, 2, 9, 8)),
+ ("19970902090807", datetime(1997, 9, 2, 9, 8, 7)),
+ ("09-25-2003", datetime(2003, 9, 25)),
+ ("25-09-2003", datetime(2003, 9, 25)),
+ ("10-09-2003", datetime(2003, 10, 9)),
+ ("10-09-03", datetime(2003, 10, 9)),
+ ("2003.09.25", datetime(2003, 9, 25)),
+ ("09.25.2003", datetime(2003, 9, 25)),
+ ("25.09.2003", datetime(2003, 9, 25)),
+ ("10.09.2003", datetime(2003, 10, 9)),
+ ("10.09.03", datetime(2003, 10, 9)),
+ ("2003/09/25", datetime(2003, 9, 25)),
+ ("09/25/2003", datetime(2003, 9, 25)),
+ ("25/09/2003", datetime(2003, 9, 25)),
+ ("10/09/2003", datetime(2003, 10, 9)),
+ ("10/09/03", datetime(2003, 10, 9)),
+ ("2003 09 25", datetime(2003, 9, 25)),
+ ("09 25 2003", datetime(2003, 9, 25)),
+ ("25 09 2003", datetime(2003, 9, 25)),
+ ("10 09 2003", datetime(2003, 10, 9)),
+ ("10 09 03", datetime(2003, 10, 9)),
+ ("25 09 03", datetime(2003, 9, 25)),
+ ("03 25 Sep", datetime(2003, 9, 25)),
+ ("25 03 Sep", datetime(2025, 9, 3)),
+ (" July 4 , 1976 12:01:02 am ", datetime(1976, 7, 4, 0, 1, 2)),
+ ("Wed, July 10, '96", datetime(1996, 7, 10, 0, 0)),
+ ("1996.July.10 AD 12:08 PM", datetime(1996, 7, 10, 12, 8)),
+ ("July 4, 1976", datetime(1976, 7, 4)),
+ ("7 4 1976", datetime(1976, 7, 4)),
+ ("4 jul 1976", datetime(1976, 7, 4)),
+ ("4 Jul 1976", datetime(1976, 7, 4)),
+ ("7-4-76", datetime(1976, 7, 4)),
+ ("0:01:02 on July 4, 1976", datetime(1976, 7, 4, 0, 1, 2)),
+ ("July 4, 1976 12:01:02 am", datetime(1976, 7, 4, 0, 1, 2)),
+ ("Mon Jan 2 04:24:27 1995", datetime(1995, 1, 2, 4, 24, 27)),
+ ("04.04.95 00:22", datetime(1995, 4, 4, 0, 22)),
+ ("Jan 1 1999 11:23:34.578", datetime(1999, 1, 1, 11, 23, 34, 578000)),
+ ("3rd of May 2001", datetime(2001, 5, 3)),
+ ("5th of March 2001", datetime(2001, 3, 5)),
+ ("1st of May 2003", datetime(2003, 5, 1)),
+ ("13NOV2017", datetime(2017, 11, 13)),
+ ("December.0031.30", datetime(31, 12, 30)),
+ ]
+ ALL_DATETIMES = ISO_DATETIMES + NON_ISO_DATETIMES
+
+ @pytest.fixture
+ def inst_str_spec(self) -> Spec:
+ return s.inst_str()
+
+ @pytest.mark.parametrize("date_str,datetime_obj", ALL_DATETIMES)
+ def test_inst_str_validation(self, inst_str_spec: Spec, date_str, datetime_obj):
+ assert inst_str_spec.is_valid(date_str)
+ assert datetime_obj == inst_str_spec.conform(date_str)
+
+ @pytest.mark.parametrize(
+ "v", ["", "abcde", "Tue September 32 2019", 5, 3.14, None, {}, set(), []]
+ )
+ def test_inst_str_validation_failure(self, inst_str_spec: Spec, v):
+ assert not inst_str_spec.is_valid(v)
+ assert INVALID is inst_str_spec.conform(v)
+
+ @pytest.fixture
+ def iso_inst_str_spec(self) -> Spec:
+ return s.inst_str(iso_only=True)
+
+ @pytest.mark.parametrize("date_str,datetime_obj", ISO_DATETIMES)
+ def test_iso_inst_str_validation(
+ self, iso_inst_str_spec: Spec, date_str, datetime_obj
+ ):
+ assert iso_inst_str_spec.is_valid(date_str)
+ assert datetime_obj == iso_inst_str_spec.conform(date_str)
+
+ @pytest.mark.parametrize(
+ "v",
+ ["", "abcde", "Tue September 32 2019", 5, 3.14, None, {}, set(), []]
+ + list(map(lambda v: v[0], NON_ISO_DATETIMES)),
+ )
+ def test_iso_inst_str_validation_failure(self, iso_inst_str_spec: Spec, v):
+ assert not iso_inst_str_spec.is_valid(v)
+ assert INVALID is iso_inst_str_spec.conform(v)
+
+
def test_nilable():
assert s.nilable(s.is_str).is_valid(None)
assert s.nilable(s.is_str).is_valid("")
@@ -1059,7 +1168,7 @@ class TestUUIDSpecValidation:
return s.uuid(versions={1, 4})
@pytest.mark.parametrize("versions", [{1, 3, 4, 8}, {1, -1}, {"1", "3", "5"}])
- def test_invalid_uuid_version_spec(self, versions) -> Spec:
+ def test_invalid_uuid_version_spec(self, versions):
with pytest.raises(ValueError):
s.uuid(versions=versions)
| Support arbitrary ISO timestamps using dateutil
Currently, the string formatters for ISO date, datetimes, and times actually come from Python's `fromisoformat` staticmethods on each of those respective classes (added in Python 3.7). Those methods do not parse arbitrary ISO 8601 formatted strings and therefore are relatively unforgiving with their formats. If we add [`dateutil`](https://github.com/dateutil/dateutil/), we can support parsing these ISO 8601 stamps arbitrarily.
Ideally, I'd like to allow `dateutil` to be specified as an install extra, so users that do not wish to install it can opt-out. | 0.0 | 10e8d508329849446ee5c630888be4e4db5f52e4 | [
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj32]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj58]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj48]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]"
]
| [
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[@gmail]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[@gmail.com]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[chris]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[chris@localhost]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[chris@]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_any",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_nilable",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-10-25 21:37:17+00:00 | mit | 1,706 |
|
coverahealth__dataspec-26 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 126f278..ce02a63 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,9 +18,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- `s.all` and `s.any` create `ValidatorSpec`s now rather than `PredicateSpec`s
which yield richer error details from constituent Specs
+- Add `bytes` exact length validation
### Fixed
- Guard against `inspect.signature` failures with Python builtins (#18)
+- `s.date`, `s.inst`, and `s.time` spec factory `before` and `after` must now
+ agree (`before` must be strictly equal to or before `after`) (#25)
+
## [0.1.0] - 2019-10-20
### Added
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index 8bebb82..fdfe114 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -142,7 +142,14 @@ def bool_spec(
allowed_values: Optional[Set[bool]] = None,
conformer: Optional[Conformer] = None,
) -> Spec:
- """Return a Spec which returns True for boolean values."""
+ """
+ Return a Spec which will validate boolean values.
+
+ :param tag: an optional tag for the resulting spec
+ :param allowed_values: if specified, a set of allowed boolean values
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates boolean values
+ """
assert allowed_values is None or all(isinstance(e, bool) for e in allowed_values)
@@ -170,11 +177,41 @@ def bool_spec(
def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
tag: Optional[Tag] = None,
type_: Tuple[Union[Type[bytes], Type[bytearray]], ...] = (bytes, bytearray),
+ length: Optional[int] = None,
minlength: Optional[int] = None,
maxlength: Optional[int] = None,
conformer: Optional[Conformer] = None,
) -> Spec:
- """Return a spec that can validate bytes and bytearrays against common rules."""
+ """
+ Return a spec that can validate bytes and bytearrays against common rules.
+
+ If ``type_`` is specified, the resulting Spec will only validate the byte type
+ or types named by ``type_``, otherwise :py:class:`byte` and :py:class:`bytearray`
+ will be used.
+
+ If ``length`` is specified, the resulting Spec will validate that input bytes
+ measure exactly ``length`` bytes by by :py:func:`len`. If ``minlength`` is
+ specified, the resulting Spec will validate that input bytes measure at least
+ ``minlength`` bytes by by :py:func:`len`. If ``maxlength`` is specified, the
+ resulting Spec will validate that input bytes measure not more than ``maxlength``
+ bytes by by :py:func:`len`. Only one of ``length``, ``minlength``, or ``maxlength``
+ can be specified. If more than one is specified a :py:exc:`ValueError` will be
+ raised. If any length value is specified less than 0 a :py:exc:`ValueError` will
+ be raised. If any length value is not an :py:class:`int` a :py:exc:`TypeError`
+ will be raised.
+
+ :param tag: an optional tag for the resulting spec
+ :param type_: a single :py:class:`type` or tuple of :py:class:`type`s which
+ will be used to type check input values by the resulting Spec
+ :param length: if specified, the resulting Spec will validate that bytes are
+ exactly ``length`` bytes long by :py:func:`len`
+ :param minlength: if specified, the resulting Spec will validate that bytes are
+ not fewer than ``minlength`` bytes long by :py:func:`len`
+ :param maxlength: if specified, the resulting Spec will validate that bytes are
+ not longer than ``maxlength`` bytes long by :py:func:`len`
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates bytes and bytearrays
+ """
@pred_to_validator(f"Value '{{value}}' is not a {type_}", complement=True)
def is_bytes(s: Any) -> bool:
@@ -182,6 +219,26 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
validators: List[Union[ValidatorFn, ValidatorSpec]] = [is_bytes]
+ if length is not None:
+
+ if not isinstance(length, int):
+ raise TypeError("Byte length spec must be an integer length")
+
+ if length < 0:
+ raise ValueError("Byte length spec cannot be less than 0")
+
+ if minlength is not None or maxlength is not None:
+ raise ValueError(
+ "Cannot define a byte spec with exact length "
+ "and minlength or maxlength"
+ )
+
+ @pred_to_validator(f"Bytes length does not equal {length}", convert_value=len)
+ def bytestr_is_exactly_len(v: Union[bytes, bytearray]) -> bool:
+ return len(v) != length
+
+ validators.append(bytestr_is_exactly_len)
+
if minlength is not None:
if not isinstance(minlength, int):
@@ -193,7 +250,7 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
@pred_to_validator(
f"Bytes '{{value}}' does not meet minimum length {minlength}"
)
- def bytestr_has_min_length(s: str) -> bool:
+ def bytestr_has_min_length(s: Union[bytes, bytearray]) -> bool:
return len(s) < minlength # type: ignore
validators.append(bytestr_has_min_length)
@@ -207,7 +264,7 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
raise ValueError("Byte maxlength spec cannot be less than 0")
@pred_to_validator(f"Bytes '{{value}}' exceeds maximum length {maxlength}")
- def bytestr_has_max_length(s: str) -> bool:
+ def bytestr_has_max_length(s: Union[bytes, bytearray]) -> bool:
return len(s) > maxlength # type: ignore
validators.append(bytestr_has_max_length)
@@ -226,7 +283,13 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
def every_spec(
tag: Optional[Tag] = None, conformer: Optional[Conformer] = None
) -> Spec:
- """Return a Spec which returns True for every possible value."""
+ """
+ Return a Spec which validates every possible value.
+
+ :param tag: an optional tag for the resulting spec
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates any value
+ """
def always_true(_) -> bool:
return True
@@ -243,6 +306,38 @@ def _make_datetime_spec_factory(
Yep.
"""
+ aware_docstring_blurb = (
+ """If ``is_aware`` is :py:obj:`True`, the resulting Spec will validate that input
+ values are timezone aware. If ``is_aware`` is :py:obj:`False`, the resulting Spec
+ will validate that inpute values are naive. If unspecified, the resulting Spec
+ will not consider whether the input value is naive or aware."""
+ if type_ is not date
+ else """If ``is_aware`` is specified, a :py:exc:`TypeError` will be raised as
+ :py:class:`datetime.date` values cannot be aware or naive."""
+ )
+
+ docstring = f"""
+ Return a Spec which validates :py:class:`datetime.{type_.__name__}` types with
+ common rules.
+
+ If ``before`` is specified, the resulting Spec will validate that input values
+ are before ``before`` by Python's ``<`` operator. If ``after`` is specified, the
+ resulting Spec will validate that input values are after ``after`` by Python's
+ ``>`` operator. If ``before`` and ``after`` are specified and ``after`` is before
+ ``before``, a :py:exc:`ValueError` will be raised.
+
+ {aware_docstring_blurb}
+
+ :param tag: an optional tag for the resulting spec
+ :param before: if specified, the input value must come before this date or time
+ :param after: if specified, the input value must come after this date or time
+ :param is_aware: if :py:obj:`True`, validate that input objects are timezone
+ aware; if :py:obj:`False`, validate that input objects are naive; if
+ :py:obj:`None`, do not consider whether the input value is naive or aware
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates :py:class:`datetime.{type_.__name__}` types
+ """
+
def _datetime_spec_factory(
tag: Optional[Tag] = None,
before: Optional[type_] = None, # type: ignore
@@ -250,8 +345,6 @@ def _make_datetime_spec_factory(
is_aware: Optional[bool] = None,
conformer: Optional[Conformer] = None,
) -> Spec:
- """Return a Spec which validates datetime types with common rules."""
-
@pred_to_validator(f"Value '{{value}}' is not {type_}", complement=True)
def is_datetime_type(v) -> bool:
return isinstance(v, type_)
@@ -274,6 +367,13 @@ def _make_datetime_spec_factory(
validators.append(is_after)
+ if after is not None and before is not None:
+ if after < before:
+ raise ValueError(
+ "Date spec 'after' criteria must be after"
+ "'before' criteria if both specified"
+ )
+
if is_aware is not None:
if type_ is datetime:
@@ -302,6 +402,7 @@ def _make_datetime_spec_factory(
tag or type_.__name__, *validators, conformer=conformer
)
+ _datetime_spec_factory.__doc__ = docstring
return _datetime_spec_factory
@@ -388,7 +489,16 @@ else:
def nilable_spec(
*args: Union[Tag, SpecPredicate], conformer: Optional[Conformer] = None
) -> Spec:
- """Return a Spec which either satisfies a single Spec predicate or which is None."""
+ """
+ Return a Spec which will validate values either by the input Spec or allow
+ the value :py:obj:`None`.
+
+ :param tag: an optional tag for the resulting spec
+ :param pred: a Spec or value which can be converted into a Spec
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates either according to ``pred`` or the value
+ :py:obj:`None`
+ """
tag, preds = _tag_maybe(*args) # pylint: disable=no-value-for-parameter
assert len(preds) == 1, "Only one predicate allowed"
spec = make_spec(cast("SpecPredicate", preds[0]))
@@ -409,7 +519,29 @@ def num_spec(
max_: Union[complex, float, int, None] = None,
conformer: Optional[Conformer] = None,
) -> Spec:
- """Return a spec that can validate numeric values against common rules."""
+ """
+ Return a Spec that can validate numeric values against common rules.
+
+ If ``type_`` is specified, the resulting Spec will only validate the numeric
+ type or types named by ``type_``, otherwise :py:class:`float` and :py:class:`int`
+ will be used.
+
+ If ``min_`` is specified, the resulting Spec will validate that input values are
+ at least ``min_`` using Python's ``<`` operator. If ``max_`` is specified, the
+ resulting Spec will validate that input values are not more than ``max_`` using
+ Python's ``<`` operator. If ``min_`` and ``max_`` are specified and ``max_`` is
+ less than ``min_``, a :py:exc:`ValueError` will be raised.
+
+ :param tag: an optional tag for the resulting spec
+ :param type_: a single :py:class:`type` or tuple of :py:class:`type`s which
+ will be used to type check input values by the resulting Spec
+ :param min_: if specified, the resulting Spec will validate that numeric values
+ are not less than ``min_`` (as by ``<``)
+ :param max_: if specified, the resulting Spec will validate that numeric values
+ are not less than ``max_`` (as by ``>``)
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates numeric values
+ """
@pred_to_validator(f"Value '{{value}}' is not type {type_}", complement=True)
def is_numeric_type(x: Any) -> bool:
@@ -729,7 +861,69 @@ def str_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
conform_format: Optional[str] = None,
conformer: Optional[Conformer] = None,
) -> Spec:
- """Return a spec that can validate strings against common rules."""
+ """
+ Return a Spec that can validate strings against common rules.
+
+ String Specs always validate that the input value is a :py:class:`str` type.
+
+ If ``length`` is specified, the resulting Spec will validate that input strings
+ measure exactly ``length`` characters by by :py:func:`len`. If ``minlength`` is
+ specified, the resulting Spec will validate that input strings measure at least
+ ``minlength`` characters by by :py:func:`len`. If ``maxlength`` is specified,
+ the resulting Spec will validate that input strings measure not more than
+ ``maxlength`` characters by by :py:func:`len`. Only one of ``length``,
+ ``minlength``, or ``maxlength`` can be specified. If more than one is specified a
+ :py:exc:`ValueError` will be raised. If any length value is specified less than 0
+ a :py:exc:`ValueError` will be raised. If any length value is not an
+ :py:class:`int` a :py:exc:`TypeError` will be raised.
+
+ If ``regex`` is specified, a Regex pattern will be created by :py:func:`re.compile`
+ and :py:func:`re.fullmatch` will be used to validate input strings. If ``format_``
+ is specified, the input string will be validated using the Spec registered to
+ validate for the string name of the format. If ``conform_format`` is specified,
+ the input string will be validated using the Spec registered to validate for the
+ string name of the format and the default conformer registered with the format
+ Spec will be set as the ``conformer`` for the resulting Spec. Only one of
+ ``regex``, ``format_``, and ``conform_format`` may be specified when creating a
+ string Spec; if more than one is specified, a :py:exc:`ValueError` will be
+ raised.
+
+ String format Specs may be registered using the function
+ :py:func:`dataspec.factories.register_str_format_spec`. Alternatively, a string
+ format validator function may be registered using the decorator
+ :py:func:`dataspec.factories.register_str_format`. String formats may include a
+ default conformer which will be applied for ``conform_format`` usages of the
+ format.
+
+ Several useful defaults are supplied as part of this library:
+
+ * `email` validates that a string contains a valid email address format (though
+ not necessarily that the username or hostname exists or that the email address
+ would be able to receive email)
+ * `iso-date` validates that a string contains a valid ISO 8601 date string
+ * `iso-datetime` (Python 3.7+) validates that a string contains a valid ISO 8601
+ date and time stamp
+ * `iso-time` (Python 3.7+) validates that a string contains a valid ISO 8601
+ time string
+ * `uuid` validates that a string contains a valid UUID
+
+ :param tag: an optional tag for the resulting spec
+ :param length: if specified, the resulting Spec will validate that strings are
+ exactly ``length`` characters long by :py:func:`len`
+ :param minlength: if specified, the resulting Spec will validate that strings are
+ not fewer than ``minlength`` characters long by :py:func:`len`
+ :param maxlength: if specified, the resulting Spec will validate that strings are
+ not longer than ``maxlength`` characters long by :py:func:`len`
+ :param regex: if specified, the resulting Spec will validate that strings match
+ the ``regex`` pattern using :py:func:`re.fullmatch`
+ :param format_: if specified, the resulting Spec will validate that strings match
+ the registered string format ``format``
+ :param conform_format: if specified, the resulting Spec will validate that strings
+ match the registered string format ``conform_format``; the resulting Spec will
+ automatically use the default conformer supplied with the string format
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates strings
+ """
@pred_to_validator(f"Value '{{value}}' is not a string", complement=True)
def is_str(s: Any) -> bool:
@@ -1040,7 +1234,22 @@ def uuid_spec(
versions: Optional[Set[int]] = None,
conformer: Optional[Conformer] = None,
) -> Spec:
- """Return a spec that can validate UUIDs against common rules."""
+ """
+ Return a Spec that can validate UUIDs against common rules.
+
+ UUID Specs always validate that the input value is a :py:class:`uuid.UUID` type.
+
+ If ``versions`` is specified, the resulting Spec will validate that input UUIDs
+ are the RFC 4122 variant and that they are one of the specified integer versions
+ of RFC 4122 variant UUIDs. If ``versions`` specifies an invalid RFC 4122 variant
+ UUID version, a :py:exc:`ValueError` will be raised.
+
+ :param tag: an optional tag for the resulting spec
+ :param versions: an optional set of integers of 1, 3, 4, and 5 which the input
+ :py:class:`uuid.UUID` must match; otherwise, any version will pass the Spec
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates UUIDs
+ """
@pred_to_validator(f"Value '{{value}}' is not a UUID", complement=True)
def is_uuid(v: Any) -> bool:
| coverahealth/dataspec | 33db5f2971e92bffd750680d864b4a4418e8fe6f | diff --git a/tests/test_factories.py b/tests/test_factories.py
index f408609..4a9c894 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -146,6 +146,41 @@ class TestBytesSpecValidation:
def test_not_is_bytes(self, v):
assert not s.is_bytes.is_valid(v)
+ class TestLengthValidation:
+ @pytest.fixture
+ def length_spec(self) -> Spec:
+ return s.bytes(length=3)
+
+ @pytest.mark.parametrize("v", [-1, -100])
+ def test_min_count(self, v):
+ with pytest.raises(ValueError):
+ return s.bytes(length=v)
+
+ @pytest.mark.parametrize("v", [-0.5, 0.5, 2.71])
+ def test_int_count(self, v):
+ with pytest.raises(TypeError):
+ s.bytes(length=v)
+
+ @pytest.mark.parametrize("v", [b"xxx", b"xxy", b"773", b"833"])
+ def test_length_spec(self, length_spec: Spec, v):
+ assert length_spec.is_valid(v)
+
+ @pytest.mark.parametrize("v", [b"", b"x", b"xx", b"xxxx", b"xxxxx"])
+ def test_length_spec_failure(self, length_spec: Spec, v):
+ assert not length_spec.is_valid(v)
+
+ @pytest.mark.parametrize(
+ "opts",
+ [
+ {"length": 2, "minlength": 3},
+ {"length": 2, "maxlength": 3},
+ {"length": 2, "minlength": 1, "maxlength": 3},
+ ],
+ )
+ def test_length_and_minlength_or_maxlength_agreement(self, opts):
+ with pytest.raises(ValueError):
+ s.bytes(**opts)
+
class TestMinlengthSpec:
@pytest.fixture
def minlength_spec(self) -> Spec:
@@ -304,6 +339,22 @@ class TestInstSpecValidation:
def test_after_spec_failure(self, after_spec: Spec, v):
assert not after_spec.is_valid(v)
+ def test_before_after_agreement(self):
+ s.inst(
+ before=datetime(year=2000, month=1, day=1),
+ after=datetime(year=2000, month=1, day=1),
+ )
+ s.inst(
+ before=datetime(year=2000, month=1, day=1),
+ after=datetime(year=2000, month=1, day=2),
+ )
+
+ with pytest.raises(ValueError):
+ s.inst(
+ before=datetime(year=2000, month=1, day=2),
+ after=datetime(year=2000, month=1, day=1),
+ )
+
class TestIsAwareSpec:
@pytest.fixture
def aware_spec(self) -> Spec:
@@ -379,6 +430,22 @@ class TestDateSpecValidation:
def test_after_spec_failure(self, after_spec: Spec, v):
assert not after_spec.is_valid(v)
+ def test_before_after_agreement(self):
+ s.date(
+ before=date(year=2000, month=1, day=1),
+ after=date(year=2000, month=1, day=1),
+ )
+ s.date(
+ before=date(year=2000, month=1, day=1),
+ after=date(year=2000, month=1, day=2),
+ )
+
+ with pytest.raises(ValueError):
+ s.date(
+ before=date(year=2000, month=1, day=2),
+ after=date(year=2000, month=1, day=1),
+ )
+
class TestIsAwareSpec:
def test_aware_spec(self):
s.date(is_aware=False)
@@ -465,6 +532,22 @@ class TestTimeSpecValidation:
def test_after_spec_failure(self, after_spec: Spec, v):
assert not after_spec.is_valid(v)
+ def test_before_after_agreement(self):
+ s.date(
+ before=time(hour=12, minute=0, second=0),
+ after=time(hour=12, minute=0, second=0),
+ )
+ s.date(
+ before=time(hour=12, minute=0, second=0),
+ after=time(hour=12, minute=0, second=1),
+ )
+
+ with pytest.raises(ValueError):
+ s.date(
+ before=time(hour=12, minute=0, second=2),
+ after=time(hour=12, minute=0, second=0),
+ )
+
class TestIsAwareSpec:
@pytest.fixture
def aware_spec(self) -> Spec:
@@ -581,10 +664,9 @@ class TestInstStringSpecValidation:
assert INVALID is iso_inst_str_spec.conform(v)
-def test_nilable():
- assert s.nilable(s.is_str).is_valid(None)
- assert s.nilable(s.is_str).is_valid("")
- assert s.nilable(s.is_str).is_valid("a string")
[email protected]("v", [None, "", "a string"])
+def test_nilable(v):
+ assert s.nilable(s.is_str).is_valid(v)
class TestNumSpecValidation:
@@ -735,7 +817,7 @@ class TestStringSpecValidation:
s.str(length=v)
@pytest.mark.parametrize("v", ["xxx", "xxy", "773", "833"])
- def test_maxlength_spec(self, count_spec: Spec, v):
+ def test_count_spec(self, count_spec: Spec, v):
assert count_spec.is_valid(v)
@pytest.mark.parametrize("v", ["", "x", "xx", "xxxx", "xxxxx"])
| `s.date`, `s.inst`, and `s.time` allow `before` and `after` disagreement
Each of the date/time related Spec factories (`s.date`, `s.inst`, and `s.time`) allow their `before` and `after` conditions to disagree (that is: `before` may be after `after`). | 0.0 | 33db5f2971e92bffd750680d864b4a4418e8fe6f | [
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::test_any",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj32]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj48]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj58]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::test_nilable[None]",
"tests/test_factories.py::test_nilable[]",
"tests/test_factories.py::test_nilable[a",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[chris@localhost]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_email_str[[email protected]]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[chris]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[chris@]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[@gmail]",
"tests/test_factories.py::TestStringFormatValidation::TestEmailFormat::test_is_not_email_str[@gmail.com]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-10-26 23:21:38+00:00 | mit | 1,707 |
|
coverahealth__dataspec-30 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8f91622..a261bc1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add email address string format (#6)
- Add URL string format factory `s.url` (#16)
- Add Python `dateutil` support for parsing dates (#5)
-- Add Python `phonenumbers` support for parsing international telephone numbes (#10)
+- Add Python `phonenumbers` support for parsing international telephone numbers (#10)
+- Add format string (`strptime`) support to date/time spec factories (#29)
### Changed
- `s.all` and `s.any` create `ValidatorSpec`s now rather than `PredicateSpec`s
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index 6ebdaea..3c81657 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -298,7 +298,11 @@ def every_spec(
return PredicateSpec(tag or "every", always_true, conformer=conformer)
-def _make_datetime_spec_factory(
+_DEFAULT_STRPTIME_DATE = date(1900, 1, 1)
+_DEFAULT_STRPTIME_TIME = time()
+
+
+def _make_datetime_spec_factory( # noqa: MC0001
type_: Union[Type[datetime], Type[date], Type[time]]
) -> Callable[..., Spec]:
"""
@@ -317,10 +321,23 @@ def _make_datetime_spec_factory(
:py:class:`datetime.date` values cannot be aware or naive."""
)
+ format_docstring_blurb = (
+ f"""If the
+ :py:class:`datetime.datetime` object parsed from the ``format_`` string contains
+ a portion not available in :py:class:`datetime.{type_.__name__}, then the
+ validator will emit an error at runtime."""
+ if type_ is not datetime
+ else ""
+ )
+
docstring = f"""
Return a Spec which validates :py:class:`datetime.{type_.__name__}` types with
common rules.
+ If ``format_`` is specified, the resulting Spec will accept string values and
+ attempt to coerce them to :py:class:`datetime.{type_.__name__}` instances first
+ before applying the other specified validations. {format_docstring_blurb}
+
If ``before`` is specified, the resulting Spec will validate that input values
are before ``before`` by Python's ``<`` operator. If ``after`` is specified, the
resulting Spec will validate that input values are after ``after`` by Python's
@@ -330,6 +347,10 @@ def _make_datetime_spec_factory(
{aware_docstring_blurb}
:param tag: an optional tag for the resulting spec
+ :param format: if specified, a time format string which will be fed to
+ :py:meth:`datetime.{type_.__name__}.strptime` to convert the input string
+ to a :py:class:`datetime.{type_.__name__}` before applying the other
+ validations
:param before: if specified, the input value must come before this date or time
:param after: if specified, the input value must come after this date or time
:param is_aware: if :py:obj:`True`, validate that input objects are timezone
@@ -339,8 +360,30 @@ def _make_datetime_spec_factory(
:return: a Spec which validates :py:class:`datetime.{type_.__name__}` types
"""
- def _datetime_spec_factory(
+ if type_ is date:
+
+ def strptime(s: str, fmt: str) -> date:
+ parsed = datetime.strptime(s, fmt)
+ if parsed.time() != _DEFAULT_STRPTIME_TIME:
+ raise TypeError(f"Parsed time includes date portion: {parsed.time()}")
+ return parsed.date()
+
+ elif type_ is time:
+
+ def strptime(s: str, fmt: str) -> time: # type: ignore
+ parsed = datetime.strptime(s, fmt)
+ if parsed.date() != _DEFAULT_STRPTIME_DATE:
+ raise TypeError(f"Parsed date includes time portion: {parsed.date()}")
+ return parsed.time()
+
+ else:
+ assert type_ is datetime
+
+ strptime = datetime.strptime # type: ignore
+
+ def _datetime_spec_factory( # pylint: disable=too-many-arguments
tag: Optional[Tag] = None,
+ format_: Optional[str] = None,
before: Optional[type_] = None, # type: ignore
after: Optional[type_] = None, # type: ignore
is_aware: Optional[bool] = None,
@@ -399,9 +442,45 @@ def _make_datetime_spec_factory(
elif is_aware is True:
raise TypeError(f"Type {type_} cannot be timezone aware")
- return ValidatorSpec.from_validators(
- tag or type_.__name__, *validators, conformer=conformer
- )
+ if format_ is not None:
+
+ def conform_datetime_str(s: str) -> Union[datetime, date, time, Invalid]:
+ try:
+ return strptime(s, format_) # type: ignore
+ except (TypeError, ValueError):
+ return INVALID
+
+ def validate_datetime_str(s: str) -> Iterator[ErrorDetails]:
+ try:
+ dt = strptime(s, format_) # type: ignore
+ except TypeError as e:
+ yield ErrorDetails(
+ message=f"String contains invalid portion for type: {e}",
+ pred=validate_datetime_str,
+ value=s,
+ )
+ except ValueError:
+ yield ErrorDetails(
+ message=(
+ "String does not contain a date which can be "
+ f"parsed as '{format_}'"
+ ),
+ pred=validate_datetime_str,
+ value=s,
+ )
+ else:
+ for validate in validators:
+ yield from validate(dt)
+
+ return ValidatorSpec(
+ tag or type.__name__,
+ validate_datetime_str,
+ conformer=conformer or conform_datetime_str,
+ )
+ else:
+ return ValidatorSpec.from_validators(
+ tag or type_.__name__, *validators, conformer=conformer
+ )
_datetime_spec_factory.__doc__ = docstring
return _datetime_spec_factory
| coverahealth/dataspec | 5474509121f7b4d78e7e99c35e681202df358a81 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index de0d9f1..44f7962 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -352,6 +352,38 @@ class TestInstSpecValidation:
def test_is_inst_failure(self, v):
assert not s.is_inst.is_valid(v)
+ class TestFormatSpec:
+ @pytest.fixture
+ def format_spec(self) -> Spec:
+ return s.inst(format_="%Y-%m-%d %I:%M:%S")
+
+ @pytest.mark.parametrize(
+ "v,parsed",
+ [
+ ("2003-01-14 01:41:16", datetime(2003, 1, 14, 1, 41, 16)),
+ ("0994-12-31 08:00:00", datetime(994, 12, 31, 8)),
+ ],
+ )
+ def test_is_inst_spec(self, format_spec: Spec, v, parsed: date):
+ assert format_spec.is_valid(v)
+ assert parsed == format_spec.conform(v)
+
+ @pytest.mark.parametrize(
+ "v",
+ [
+ "994-12-31",
+ "2000-13-20",
+ "1984-09-32",
+ "84-10-4",
+ "23:18:22",
+ "11:40:72",
+ "06:89:13",
+ ],
+ )
+ def test_is_not_inst_spec(self, format_spec: Spec, v):
+ assert not format_spec.is_valid(v)
+ assert INVALID is format_spec.conform(v)
+
class TestBeforeSpec:
@pytest.fixture
def before_spec(self) -> Spec:
@@ -469,6 +501,34 @@ class TestDateSpecValidation:
def test_is_date_failure(self, v):
assert not s.is_date.is_valid(v)
+ class TestFormatSpec:
+ @pytest.fixture
+ def format_spec(self) -> Spec:
+ return s.date(format_="%Y-%m-%d")
+
+ @pytest.mark.parametrize(
+ "v,parsed",
+ [("2003-01-14", date(2003, 1, 14)), ("0994-12-31", date(994, 12, 31))],
+ )
+ def test_is_date_spec(self, format_spec: Spec, v, parsed: date):
+ assert format_spec.is_valid(v)
+ assert parsed == format_spec.conform(v)
+
+ # Even though a value like "2003-1-14" should be invalid by the chosen
+ # format string, Python's strptime implementation appears to be more
+ # lenient than it should: https://bugs.python.org/issue33941
+ @pytest.mark.parametrize(
+ "v", ["994-12-31", "2000-13-20", "1984-09-32", "84-10-4"]
+ )
+ def test_is_not_date_spec(self, format_spec: Spec, v):
+ assert not format_spec.is_valid(v)
+ assert INVALID is format_spec.conform(v)
+
+ def test_date_spec_with_time_fails(self):
+ assert not s.date(format_="%Y-%m-%d %H:%M:%S").is_valid(
+ "2003-11-20 22:16:08"
+ )
+
class TestBeforeSpec:
@pytest.fixture
def before_spec(self) -> Spec:
@@ -567,6 +627,28 @@ class TestTimeSpecValidation:
def test_is_time_failure(self, v):
assert not s.is_time.is_valid(v)
+ class TestFormatSpec:
+ @pytest.fixture
+ def format_spec(self) -> Spec:
+ return s.time(format_="%I:%M:%S")
+
+ @pytest.mark.parametrize(
+ "v,parsed", [("01:41:16", time(1, 41, 16)), ("08:00:00", time(8))]
+ )
+ def test_is_time_spec(self, format_spec: Spec, v, parsed: date):
+ assert format_spec.is_valid(v)
+ assert parsed == format_spec.conform(v)
+
+ @pytest.mark.parametrize("v", ["23:18:22", "11:40:72", "06:89:13"])
+ def test_is_not_time_spec(self, format_spec: Spec, v):
+ assert not format_spec.is_valid(v)
+ assert INVALID is format_spec.conform(v)
+
+ def test_time_spec_with_date_fails(self):
+ assert not s.time(format_="%Y-%m-%d %H:%M:%S").is_valid(
+ "2003-11-20 22:16:08"
+ )
+
class TestBeforeSpec:
@pytest.fixture
def before_spec(self) -> Spec:
| Support `strptime` formats for `s.date`, `s.inst`, and `s.time`
We should add support for `datetime.strptime` to let users specify arbitrary string format strings for `s.date`, `s.inst`, and `s.time` spec factories. | 0.0 | 5474509121f7b4d78e7e99c35e681202df358a81 | [
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[2003-01-14",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[0994-12-31",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[994-12-31]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[2000-13-20]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[1984-09-32]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[84-10-4]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[23:18:22]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[11:40:72]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[06:89:13]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[2003-01-14-parsed0]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[0994-12-31-parsed1]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[994-12-31]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[2000-13-20]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[1984-09-32]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[84-10-4]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_date_spec_with_time_fails",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[01:41:16-parsed0]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[08:00:00-parsed1]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[23:18:22]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[11:40:72]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[06:89:13]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_time_spec_with_date_fails"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::test_any",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs5]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj32]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj48]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj58]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::test_nilable[None]",
"tests/test_factories.py::test_nilable[]",
"tests/test_factories.py::test_nilable[a",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-10-28 15:07:24+00:00 | mit | 1,708 |
|
coverahealth__dataspec-39 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2479c78..f4beab9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow `s.str`'s `regex` kwarg to be a pre-existing pattern returned from
`re.compile` (#36)
+### Fixed
+- `s.any` now conforms values using the first successful Spec's conformer (#35)
+
## [v0.2.1] - 2019-10-28
### Fixed
- Allow regex repetition pattern (such as `\d{5}`) in error format string
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index d46785a..415a1d4 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -56,7 +56,11 @@ def _tag_maybe(
return tag, (cast("Tuple[T, ...]", (maybe_tag, *args)) if tag is None else args)
-def any_spec(*preds: SpecPredicate, conformer: Optional[Conformer] = None) -> Spec:
+def any_spec(
+ *preds: SpecPredicate,
+ tag_conformed: bool = False,
+ conformer: Optional[Conformer] = None,
+) -> Spec:
"""
Return a Spec which validates input values against any one of an arbitrary
number of input Specs.
@@ -71,8 +75,20 @@ def any_spec(*preds: SpecPredicate, conformer: Optional[Conformer] = None) -> Sp
no :py:class:`dataspec.base.ErrorDetails` will be emitted by the
:py:meth:`dataspec.base.Spec.validate` method.
+ The conformer for the returned Spec will select the conformer for the first
+ contituent Spec which successfully validates the input value. If a ``conformer``
+ is specified for this Spec, that conformer will be applied after the successful
+ Spec's conformer. If ``tag_conformed`` is specified, the final conformed value
+ from both conformers will be wrapped in a tuple, where the first element is the
+ tag of the successful Spec and the second element is the final conformed value.
+ If ``tag_conformed`` is not specified (which is the default), the conformer will
+ emit the conformed value directly.
+
:param tag: an optional tag for the resulting spec
:param preds: one or more Specs or values which can be converted into a Spec
+ :param tag_conformed: if :py:obj:`True`, the conformed value will be wrapped in a
+ 2-tuple where the first element is the successful spec and the second element
+ is the conformed value; if :py:obj:`False`, return only the conformed value
:param conformer: an optional conformer for the value
:return: a Spec
"""
@@ -90,7 +106,23 @@ def any_spec(*preds: SpecPredicate, conformer: Optional[Conformer] = None) -> Sp
yield from errors
- return ValidatorSpec(tag or "any", _any_valid, conformer=conformer)
+ def _conform_any(e):
+ for spec in specs:
+ spec_errors = [error for error in spec.validate(e)]
+ if spec_errors:
+ continue
+ else:
+ conformed = spec.conform_valid(e)
+ assert conformed is not INVALID
+ if conformer is not None:
+ conformed = conformer(conformed)
+ if tag_conformed:
+ conformed = (spec.tag, conformed)
+ return conformed
+
+ return INVALID
+
+ return ValidatorSpec(tag or "any", _any_valid, conformer=_conform_any)
def all_spec(*preds: SpecPredicate, conformer: Optional[Conformer] = None) -> Spec:
| coverahealth/dataspec | 1666f6fef501c133589501bd86c8d61559d276e3 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index 40e2efc..ee64c61 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -87,15 +87,109 @@ class TestAllSpecConformation:
assert expected == all_spec.conform(v)
-def test_any():
- spec = s.any(s.is_num, s.is_str)
- assert spec.is_valid("5")
- assert spec.is_valid(5)
- assert spec.is_valid(3.14)
- assert not spec.is_valid(None)
- assert not spec.is_valid({})
- assert not spec.is_valid(set())
- assert not spec.is_valid([])
+class TestAnySpecValidation:
+ @pytest.fixture
+ def any_spec(self) -> Spec:
+ return s.any(s.is_num, s.is_str)
+
+ @pytest.mark.parametrize("v", ["5", 5, 3.14])
+ def test_any_validation(self, any_spec: Spec, v):
+ assert any_spec.is_valid(v)
+
+ @pytest.mark.parametrize("v", [None, {}, set(), []])
+ def test_any_validation_failure(self, any_spec: Spec, v):
+ assert not any_spec.is_valid(v)
+
+
+class TestAnySpecConformation:
+ @pytest.fixture
+ def spec(self) -> Spec:
+ return s.any(s.num("num"), s.str("numstr", regex=r"\d+", conformer=int))
+
+ @pytest.mark.parametrize("expected,v", [(5, "5"), (5, 5), (3.14, 3.14), (-10, -10)])
+ def test_conformation(self, spec: Spec, expected, v):
+ assert expected == spec.conform(v)
+
+ @pytest.mark.parametrize(
+ "v", [None, {}, set(), [], "500x", "Just a sentence", b"500", b"byteword"]
+ )
+ def test_conformation_failure(self, spec: Spec, v):
+ assert INVALID is spec.conform(v)
+
+ @pytest.fixture
+ def tag_spec(self) -> Spec:
+ return s.any(
+ s.num("num"),
+ s.str("numstr", regex=r"\d+", conformer=int),
+ tag_conformed=True,
+ )
+
+ @pytest.mark.parametrize(
+ "expected,v",
+ [
+ (("numstr", 5), "5"),
+ (("num", 5), 5),
+ (("num", 3.14), 3.14),
+ (("num", -10), -10),
+ ],
+ )
+ def test_tagged_conformation(self, tag_spec: Spec, expected, v):
+ assert expected == tag_spec.conform(v)
+
+ @pytest.mark.parametrize(
+ "v", [None, {}, set(), [], "500x", "Just a sentence", b"500", b"byteword"]
+ )
+ def test_tagged_conformation_failure(self, tag_spec: Spec, v):
+ assert INVALID is tag_spec.conform(v)
+
+
+class TestAnySpecWithOuterConformation:
+ @pytest.fixture
+ def spec(self) -> Spec:
+ return s.any(
+ s.num("num"),
+ s.str("numstr", regex=r"\d+", conformer=int),
+ conformer=lambda v: v + 5,
+ )
+
+ @pytest.mark.parametrize(
+ "expected,v", [(10, "5"), (10, 5), (8.14, 3.14), (-5, -10)]
+ )
+ def test_conformation(self, spec: Spec, expected, v):
+ assert expected == spec.conform(v)
+
+ @pytest.mark.parametrize(
+ "v", [None, {}, set(), [], "500x", "Just a sentence", b"500", b"byteword"]
+ )
+ def test_conformation_failure(self, spec: Spec, v):
+ assert INVALID is spec.conform(v)
+
+ @pytest.fixture
+ def tag_spec(self) -> Spec:
+ return s.any(
+ s.num("num"),
+ s.str("numstr", regex=r"\d+", conformer=int),
+ tag_conformed=True,
+ conformer=lambda v: v + 5,
+ )
+
+ @pytest.mark.parametrize(
+ "expected,v",
+ [
+ (("numstr", 10), "5"),
+ (("num", 10), 5),
+ (("num", 8.14), 3.14),
+ (("num", -5), -10),
+ ],
+ )
+ def test_tagged_conformation(self, tag_spec: Spec, expected, v):
+ assert expected == tag_spec.conform(v)
+
+ @pytest.mark.parametrize(
+ "v", [None, {}, set(), [], "500x", "Just a sentence", b"500", b"byteword"]
+ )
+ def test_tagged_conformation_failure(self, tag_spec: Spec, v):
+ assert INVALID is tag_spec.conform(v)
@pytest.mark.parametrize(
| `s.any` specs do not conform values using matching conformer
Specs created with `s.any` will not conform using the conformer of the matching Spec (if any).
```python
class PhoneType(Enum):
HOME = "Home"
MOBILE = "Mobile"
OFFICE = "Office"
phone_type = s.any(
"phone_type",
s(
{"H", "M", "O", ""},
conformer=lambda v: {
"H": PhoneType.HOME,
"M": PhoneType.MOBILE,
"O": PhoneType.OFFICE,
}.get(v, ""),
),
PhoneType,
)
```
Will produce
```python
phone_type.conform("H") # = H
``` | 0.0 | 1666f6fef501c133589501bd86c8d61559d276e3 | [
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_0]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_0]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[byteword]"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_0]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[3.14]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[None]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v2]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[3.14-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[-10--10]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[8.14-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[-5--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs5]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[2003-01-14",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[0994-12-31",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[994-12-31]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[2000-13-20]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[1984-09-32]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[84-10-4]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[23:18:22]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[11:40:72]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[06:89:13]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[2003-01-14-parsed0]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[0994-12-31-parsed1]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[994-12-31]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[2000-13-20]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[1984-09-32]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[84-10-4]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_date_spec_with_time_fails",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[01:41:16-parsed0]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[08:00:00-parsed1]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[23:18:22]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[11:40:72]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[06:89:13]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_time_spec_with_date_fails",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj32]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj48]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj58]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::test_nilable[None]",
"tests/test_factories.py::test_nilable[]",
"tests/test_factories.py::test_nilable[a",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-11-27 20:29:06+00:00 | mit | 1,709 |
|
coverahealth__dataspec-4 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9436e01..e88328b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Add an exact length validator to the string spec factory (#2)
- Add conforming string formats (#3)
+- Add ISO time string format (#4)
## [0.1.0] - 2019-10-20
### Added
diff --git a/src/dataspec/impl.py b/src/dataspec/impl.py
index 769230e..a7ae7a8 100644
--- a/src/dataspec/impl.py
+++ b/src/dataspec/impl.py
@@ -1006,6 +1006,17 @@ if sys.version_info >= (3, 7):
value=s,
)
+ @register_str_format("iso-time", conformer=time.fromisoformat)
+ def _str_is_iso_time(s: str) -> Iterator[ErrorDetails]:
+ try:
+ time.fromisoformat(s)
+ except ValueError:
+ yield ErrorDetails(
+ message=f"String does not contain ISO formatted time",
+ pred=_str_is_iso_time,
+ value=s,
+ )
+
else:
| coverahealth/dataspec | 55a75c05b68e815a16fa10b2311a741ca4087fb2 | diff --git a/tests/test_dataspec.py b/tests/test_dataspec.py
index 77ce686..a706606 100644
--- a/tests/test_dataspec.py
+++ b/tests/test_dataspec.py
@@ -1432,6 +1432,71 @@ class TestStringSpecValidation:
assert not datetime_spec.is_valid(v)
assert not conforming_datetime_spec.is_valid(v)
+ @pytest.mark.skipif(
+ sys.version_info <= (3, 7), reason="time.fromisoformat added in Python 3.7"
+ )
+ class TestISOTimeFormat:
+ @pytest.fixture
+ def conform(self):
+ return time.fromisoformat
+
+ @pytest.fixture
+ def conforming_time_spec(self) -> Spec:
+ return s.str(conform_format="iso-time")
+
+ @pytest.fixture
+ def time_spec(self) -> Spec:
+ return s.str(format_="iso-time")
+
+ @pytest.mark.parametrize(
+ "v",
+ [
+ "18",
+ "18-00:00",
+ "18.335",
+ "18.335-00:00",
+ "18:03",
+ "18:03-00:00",
+ "18:03.335",
+ "18:03.335-00:00",
+ "18:03:50",
+ "18:03:50-00:00",
+ "18:03:50.617",
+ "18:03:50.617-00:00",
+ "18:03:50.617332",
+ "18:03:50.617332-00:00",
+ ],
+ )
+ def test_is_time_str(
+ self, time_spec: Spec, conforming_time_spec: Spec, conform, v
+ ):
+ assert time_spec.is_valid(v)
+ assert conforming_time_spec.is_valid(v)
+ assert conform(v) == conforming_time_spec.conform(v)
+
+ @pytest.mark.parametrize(
+ "v",
+ [
+ None,
+ 25,
+ 3.14,
+ [],
+ set(),
+ "abcdef",
+ "abcdefg",
+ "100017",
+ "10017-383",
+ "1945-9-2",
+ "430-10-02",
+ "2019-10-12",
+ "1945-09-02",
+ "1066-10-14",
+ ],
+ )
+ def test_is_not_time_str(self, time_spec: Spec, conforming_time_spec: Spec, v):
+ assert not time_spec.is_valid(v)
+ assert not conforming_time_spec.is_valid(v)
+
class TestUUIDFormat:
@pytest.fixture
def conforming_uuid_spec(self) -> Spec:
| Support ISO time strings
Currently, we support using `datetime.fromisoformat` and `date.fromisoformat` to check strings for a subset of ISO timestamps and dates. Python 3.7+ also has `time.fromisoformat`, which can validate a subset of ISO time strings.
| 0.0 | 55a75c05b68e815a16fa10b2311a741ca4087fb2 | [
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]"
]
| [
"tests/test_dataspec.py::TestSpecConstructor::test_invalid_specs[None]",
"tests/test_dataspec.py::TestSpecConstructor::test_invalid_specs[5]",
"tests/test_dataspec.py::TestSpecConstructor::test_invalid_specs[3.14]",
"tests/test_dataspec.py::TestSpecConstructor::test_invalid_specs[8j]",
"tests/test_dataspec.py::TestSpecConstructor::test_spec_with_no_pred",
"tests/test_dataspec.py::TestSpecConstructor::test_validator_spec",
"tests/test_dataspec.py::TestSpecConstructor::test_predicate_spec",
"tests/test_dataspec.py::TestCollSpecValidation::test_error_details[v0-path0]",
"tests/test_dataspec.py::TestCollSpecValidation::test_error_details[v1-path1]",
"tests/test_dataspec.py::TestCollSpecValidation::test_error_details[v2-path2]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_min_minlength[-1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_min_minlength[-100]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[-0.5]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[0.5]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[2.71]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec[coll0]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec[coll1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll0]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll2]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll3]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_min_maxlength[-1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_min_maxlength[-100]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[-0.5]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[0.5]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[2.71]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll0]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll2]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll0]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll2]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_maxlength_spec[coll0]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll0]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll2]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll3]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll4]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_dataspec.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_dataspec.py::TestCollSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_dataspec.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[frozenset]",
"tests/test_dataspec.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[list]",
"tests/test_dataspec.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[set]",
"tests/test_dataspec.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[tuple]",
"tests/test_dataspec.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[frozenset]",
"tests/test_dataspec.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[list]",
"tests/test_dataspec.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[set]",
"tests/test_dataspec.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[tuple]",
"tests/test_dataspec.py::TestCollSpecConformation::test_coll_conformation",
"tests/test_dataspec.py::TestCollSpecConformation::test_set_coll_conformation",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec[d0]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec[d1]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec[d2]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[None]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[a",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[0]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[3.14]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[True]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[False]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[d6]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[d7]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[d8]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[d9]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[d10]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[d11]",
"tests/test_dataspec.py::TestDictSpecValidation::test_dict_spec_failure[d12]",
"tests/test_dataspec.py::TestDictSpecValidation::test_error_details[v0-path0]",
"tests/test_dataspec.py::TestDictSpecValidation::test_error_details[v1-path1]",
"tests/test_dataspec.py::TestDictSpecValidation::test_error_details[v2-path2]",
"tests/test_dataspec.py::TestDictSpecConformation::test_dict_conformation",
"tests/test_dataspec.py::TestObjectSpecValidation::test_obj_spec[o0]",
"tests/test_dataspec.py::TestObjectSpecValidation::test_obj_spec[o1]",
"tests/test_dataspec.py::TestObjectSpecValidation::test_obj_spec[o2]",
"tests/test_dataspec.py::TestObjectSpecValidation::test_obj_spec_failure[o0]",
"tests/test_dataspec.py::TestObjectSpecValidation::test_obj_spec_failure[o1]",
"tests/test_dataspec.py::TestObjectSpecValidation::test_obj_spec_failure[o2]",
"tests/test_dataspec.py::TestObjectSpecValidation::test_obj_spec_failure[o3]",
"tests/test_dataspec.py::TestSetSpec::test_set_spec",
"tests/test_dataspec.py::TestSetSpec::test_set_spec_conformation",
"tests/test_dataspec.py::TestEnumSetSpec::test_enum_spec",
"tests/test_dataspec.py::TestEnumSetSpec::test_enum_spec_conformation",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec[row0]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec[row1]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec[row2]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[None]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[a",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[0]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[3.14]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[True]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[False]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[row6]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[row7]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[row8]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[row9]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[row10]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_tuple_spec_failure[row11]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_error_details[v0-path0]",
"tests/test_dataspec.py::TestTupleSpecValidation::test_error_details[v1-path1]",
"tests/test_dataspec.py::TestTupleSpecConformation::test_tuple_conformation",
"tests/test_dataspec.py::TestTupleSpecConformation::test_namedtuple_conformation",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_dataspec.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_dataspec.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_dataspec.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_dataspec.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_dataspec.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_dataspec.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_dataspec.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_dataspec.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_dataspec.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_dataspec.py::test_any",
"tests/test_dataspec.py::test_is_any[None]",
"tests/test_dataspec.py::test_is_any[25]",
"tests/test_dataspec.py::test_is_any[3.14]",
"tests/test_dataspec.py::test_is_any[3j]",
"tests/test_dataspec.py::test_is_any[v4]",
"tests/test_dataspec.py::test_is_any[v5]",
"tests/test_dataspec.py::test_is_any[v6]",
"tests/test_dataspec.py::test_is_any[v7]",
"tests/test_dataspec.py::test_is_any[abcdef]",
"tests/test_dataspec.py::TestBoolValidation::test_bool[True]",
"tests/test_dataspec.py::TestBoolValidation::test_bool[False]",
"tests/test_dataspec.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_dataspec.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_dataspec.py::TestBoolValidation::test_bool_failure[]",
"tests/test_dataspec.py::TestBoolValidation::test_bool_failure[a",
"tests/test_dataspec.py::TestBoolValidation::test_is_false",
"tests/test_dataspec.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_dataspec.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_dataspec.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_dataspec.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_dataspec.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_dataspec.py::TestBoolValidation::test_is_true",
"tests/test_dataspec.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_dataspec.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_dataspec.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_dataspec.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_dataspec.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_dataspec.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_dataspec.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_dataspec.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_dataspec.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_dataspec.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_dataspec.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_dataspec.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_dataspec.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_dataspec.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_dataspec.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_dataspec.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_dataspec.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_dataspec.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_dataspec.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_dataspec.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_dataspec.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_dataspec.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_dataspec.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_dataspec.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_dataspec.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_dataspec.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_dataspec.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_dataspec.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_dataspec.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_dataspec.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_dataspec.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_dataspec.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_dataspec.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_dataspec.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_dataspec.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_dataspec.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_dataspec.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_dataspec.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_dataspec.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_dataspec.py::test_nilable",
"tests/test_dataspec.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_dataspec.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_dataspec.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_dataspec.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_dataspec.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_dataspec.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_dataspec.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_dataspec.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_dataspec.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_dataspec.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_dataspec.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_dataspec.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_dataspec.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_dataspec.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_dataspec.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_dataspec.py::TestStringSpecValidation::test_is_str[]",
"tests/test_dataspec.py::TestStringSpecValidation::test_is_str[a",
"tests/test_dataspec.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_dataspec.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_dataspec.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_dataspec.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_dataspec.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_dataspec.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[xxx]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[xxy]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[773]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_maxlength_spec[833]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_dataspec.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_dataspec.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_dataspec.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[10017-3332]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[37779-2770]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[00000]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[None]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[25]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[3.14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v3]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[v4]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdef]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[abcdefg]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[100017]",
"tests/test_dataspec.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[10017-383]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_dataspec.py::TestStringSpecValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_dataspec.py::TestStringSpecValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_dataspec.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_dataspec.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_dataspec.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_dataspec.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_dataspec.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]",
"tests/test_dataspec.py::TestFunctionSpecs::test_arg_specs",
"tests/test_dataspec.py::TestFunctionSpecs::test_kwarg_specs",
"tests/test_dataspec.py::TestFunctionSpecs::test_return_spec"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2019-10-22 15:00:07+00:00 | mit | 1,710 |
|
coverahealth__dataspec-42 | diff --git a/src/dataspec/base.py b/src/dataspec/base.py
index e9364a9..7f07262 100644
--- a/src/dataspec/base.py
+++ b/src/dataspec/base.py
@@ -486,6 +486,22 @@ class ObjectSpec(DictSpec):
raise TypeError("Cannot use a default conformer for an Object")
+def _enum_conformer(e: EnumMeta) -> Conformer:
+ """Create a conformer for Enum types which accepts Enum instances, Enum values,
+ and Enum names."""
+
+ def conform_enum(v) -> Union[EnumMeta, Invalid]:
+ try:
+ return e(v)
+ except ValueError:
+ try:
+ return e[v]
+ except KeyError:
+ return INVALID
+
+ return conform_enum
+
+
@attr.s(auto_attribs=True, frozen=True, slots=True)
class SetSpec(Spec):
tag: Tag
@@ -668,7 +684,7 @@ def make_spec( # pylint: disable=inconsistent-return-statements
return SetSpec(
tag or pred.__name__,
frozenset(chain.from_iterable([mem, mem.name, mem.value] for mem in pred)),
- conformer=conformer or pred,
+ conformer=conformer or _enum_conformer(pred),
)
elif isinstance(pred, tuple):
return TupleSpec.from_val(tag, pred, conformer=conformer)
| coverahealth/dataspec | 70c2a947f0df85649b4e20f6c26e3f6df10838cd | diff --git a/tests/test_base.py b/tests/test_base.py
index 7261475..f0a45c6 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -526,6 +526,8 @@ class TestEnumSetSpec:
assert not enum_spec.is_valid(None)
def test_enum_spec_conformation(self, enum_spec: Spec):
+ assert self.YesNo.YES == enum_spec.conform("YES")
+ assert self.YesNo.NO == enum_spec.conform("NO")
assert self.YesNo.YES == enum_spec.conform("Yes")
assert self.YesNo.NO == enum_spec.conform("No")
assert self.YesNo.YES == enum_spec.conform(self.YesNo.YES)
@@ -533,6 +535,10 @@ class TestEnumSetSpec:
assert INVALID is enum_spec.conform("Maybe")
assert INVALID is enum_spec.conform(None)
+ # Testing the last branch of the conformer
+ assert INVALID is enum_spec.conform_valid("Maybe")
+ assert INVALID is enum_spec.conform_valid(None)
+
class TestTupleSpecValidation:
@pytest.fixture
diff --git a/tests/test_factories.py b/tests/test_factories.py
index ee64c61..0b271ee 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -115,6 +115,7 @@ class TestAnySpecConformation:
)
def test_conformation_failure(self, spec: Spec, v):
assert INVALID is spec.conform(v)
+ assert INVALID is spec.conform_valid(v)
@pytest.fixture
def tag_spec(self) -> Spec:
@@ -141,6 +142,7 @@ class TestAnySpecConformation:
)
def test_tagged_conformation_failure(self, tag_spec: Spec, v):
assert INVALID is tag_spec.conform(v)
+ assert INVALID is tag_spec.conform_valid(v)
class TestAnySpecWithOuterConformation:
@@ -163,6 +165,7 @@ class TestAnySpecWithOuterConformation:
)
def test_conformation_failure(self, spec: Spec, v):
assert INVALID is spec.conform(v)
+ assert INVALID is spec.conform_valid(v)
@pytest.fixture
def tag_spec(self) -> Spec:
@@ -190,6 +193,7 @@ class TestAnySpecWithOuterConformation:
)
def test_tagged_conformation_failure(self, tag_spec: Spec, v):
assert INVALID is tag_spec.conform(v)
+ assert INVALID is tag_spec.conform_valid(v)
@pytest.mark.parametrize(
| Enum conformers fail to conform valid Enum values
Using the example from #35:
```python
from enum import Enum
from dataspec import s
class PhoneType(Enum):
HOME = "Home"
MOBILE = "Mobile"
OFFICE = "Office"
phone_type = s.any(
"phone_type",
s(
{"H", "M", "O", ""},
conformer=lambda v: {
"H": PhoneType.HOME,
"M": PhoneType.MOBILE,
"O": PhoneType.OFFICE,
}.get(v, ""),
),
PhoneType,
)
```
```
>>> phone_type.is_valid("HOME")
True
>>> phone_type.conform("HOME")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/chris/Projects/dataspec/src/dataspec/base.py", line 161, in conform
return self.conform_valid(v)
File "/Users/chris/Projects/dataspec/src/dataspec/base.py", line 155, in conform_valid
return self.conformer(v)
File "/Users/chris/Projects/dataspec/src/dataspec/factories.py", line 115, in _conform_any
conformed = spec.conform_valid(e)
File "/Users/chris/Projects/dataspec/src/dataspec/base.py", line 155, in conform_valid
return self.conformer(v)
File "/Users/chris/.pyenv/versions/3.6.6/lib/python3.6/enum.py", line 291, in __call__
return cls.__new__(cls, value)
File "/Users/chris/.pyenv/versions/3.6.6/lib/python3.6/enum.py", line 533, in __new__
return cls._missing_(value)
File "/Users/chris/.pyenv/versions/3.6.6/lib/python3.6/enum.py", line 546, in _missing_
raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'HOME' is not a valid PhoneType
```
The problem is that we use the enum itself as the conformer, but Enums used as functions only accept the _values_ of the enum, not the _names_. | 0.0 | 70c2a947f0df85649b4e20f6c26e3f6df10838cd | [
"tests/test_base.py::TestEnumSetSpec::test_enum_spec_conformation"
]
| [
"tests/test_base.py::TestCollSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestCollSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestCollSpecValidation::test_error_details[v2-path2]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_min_minlength[-1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_min_minlength[-100]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll3]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_min_maxlength[-1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_min_maxlength[-100]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_maxlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll3]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll4]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_base.py::TestCollSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[frozenset]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[list]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[set]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[tuple]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[frozenset]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[list]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[set]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[tuple]",
"tests/test_base.py::TestCollSpecConformation::test_coll_conformation",
"tests/test_base.py::TestCollSpecConformation::test_set_coll_conformation",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d0]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d1]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d2]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[None]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[a",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[0]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[3.14]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[True]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[False]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d6]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d7]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d8]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d9]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d10]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d11]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d12]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v2-path2]",
"tests/test_base.py::TestDictSpecConformation::test_dict_conformation",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o0]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o1]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o2]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o0]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o1]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o2]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o3]",
"tests/test_base.py::TestSetSpec::test_set_spec",
"tests/test_base.py::TestSetSpec::test_set_spec_conformation",
"tests/test_base.py::TestEnumSetSpec::test_enum_spec",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row0]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row1]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row2]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[None]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[a",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[0]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[3.14]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[True]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[False]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row6]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row7]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row8]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row9]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row10]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row11]",
"tests/test_base.py::TestTupleSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestTupleSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestTupleSpecConformation::test_tuple_conformation",
"tests/test_base.py::TestTupleSpecConformation::test_namedtuple_conformation",
"tests/test_base.py::TestTypeSpec::test_typecheck[bool-vals0]",
"tests/test_base.py::TestTypeSpec::test_typecheck[bytes-vals1]",
"tests/test_base.py::TestTypeSpec::test_typecheck[dict-vals2]",
"tests/test_base.py::TestTypeSpec::test_typecheck[float-vals3]",
"tests/test_base.py::TestTypeSpec::test_typecheck[int-vals4]",
"tests/test_base.py::TestTypeSpec::test_typecheck[list-vals5]",
"tests/test_base.py::TestTypeSpec::test_typecheck[set-vals6]",
"tests/test_base.py::TestTypeSpec::test_typecheck[str-vals7]",
"tests/test_base.py::TestTypeSpec::test_typecheck[tuple-vals8]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[bool]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[bytes]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[dict]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[float]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[int]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[list]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[set]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[str]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[tuple]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_0]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[3.14]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[None]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v2]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_0]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[3.14-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[-10--10]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_0]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[8.14-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[-5--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs5]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[2003-01-14",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[0994-12-31",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[994-12-31]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[2000-13-20]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[1984-09-32]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[84-10-4]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[23:18:22]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[11:40:72]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[06:89:13]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[2003-01-14-parsed0]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[0994-12-31-parsed1]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[994-12-31]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[2000-13-20]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[1984-09-32]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[84-10-4]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_date_spec_with_time_fails",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[01:41:16-parsed0]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[08:00:00-parsed1]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[23:18:22]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[11:40:72]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[06:89:13]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_time_spec_with_date_fails",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj32]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj48]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj58]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::test_nilable[None]",
"tests/test_factories.py::test_nilable[]",
"tests/test_factories.py::test_nilable[a",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_issue_reference"
],
"has_test_patch": true,
"is_lite": false
} | 2019-11-27 21:50:56+00:00 | mit | 1,711 |
|
coverahealth__dataspec-47 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index f497a74..7699e9c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+### Added
+- Add `s.blankable` Spec for specifying optional string values (#45)
+- Add `s.default` Spec for specifying default values on failing Specs (#46)
## [v0.2.3] - 2019-11-27
diff --git a/src/dataspec/api.py b/src/dataspec/api.py
index 902f7ef..bc594ca 100644
--- a/src/dataspec/api.py
+++ b/src/dataspec/api.py
@@ -12,10 +12,12 @@ from dataspec.base import (
from dataspec.factories import (
all_spec,
any_spec,
+ blankable_spec,
bool_spec,
bytes_spec,
date_spec,
datetime_spec,
+ default_spec,
email_spec,
every_spec,
nilable_spec,
@@ -100,9 +102,11 @@ class SpecAPI:
# Spec factories
any = staticmethod(any_spec)
all = staticmethod(all_spec)
+ blankable = staticmethod(blankable_spec)
bool = staticmethod(bool_spec)
bytes = staticmethod(bytes_spec)
date = staticmethod(date_spec)
+ default = staticmethod(default_spec)
email = staticmethod(email_spec)
every = staticmethod(every_spec)
inst = staticmethod(datetime_spec)
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index 415a1d4..6189171 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -98,7 +98,7 @@ def any_spec(
def _any_valid(e) -> Iterator[ErrorDetails]:
errors = []
for spec in specs:
- spec_errors = [error for error in spec.validate(e)]
+ spec_errors = list(spec.validate(e))
if spec_errors:
errors.extend(spec_errors)
else:
@@ -108,17 +108,17 @@ def any_spec(
def _conform_any(e):
for spec in specs:
- spec_errors = [error for error in spec.validate(e)]
+ spec_errors = list(spec.validate(e))
if spec_errors:
continue
- else:
- conformed = spec.conform_valid(e)
- assert conformed is not INVALID
- if conformer is not None:
- conformed = conformer(conformed)
- if tag_conformed:
- conformed = (spec.tag, conformed)
- return conformed
+
+ conformed = spec.conform_valid(e)
+ assert conformed is not INVALID
+ if conformer is not None:
+ conformed = conformer(conformed)
+ if tag_conformed:
+ conformed = (spec.tag, conformed)
+ return conformed
return INVALID
@@ -171,6 +171,27 @@ def all_spec(*preds: SpecPredicate, conformer: Optional[Conformer] = None) -> Sp
)
+def blankable_spec(
+ *args: Union[Tag, SpecPredicate], conformer: Optional[Conformer] = None
+):
+ """
+ Return a Spec which will validate values either by the input Spec or allow the
+ empty string.
+
+ The returned Spec is equivalent to `s.any(spec, {""})`.
+
+ :param tag: an optional tag for the resulting spec
+ :param pred: a Spec or value which can be converted into a Spec
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates either according to ``pred`` or the empty string
+ """
+ tag, preds = _tag_maybe(*args) # pylint: disable=no-value-for-parameter
+ assert len(preds) == 1, "Only one predicate allowed"
+ return any_spec(
+ tag or "blankable", preds[0], {""}, conformer=conformer # type: ignore
+ )
+
+
def bool_spec(
tag: Optional[Tag] = None,
allowed_values: Optional[Set[bool]] = None,
@@ -314,6 +335,38 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
)
+def default_spec(
+ *args: Union[Tag, SpecPredicate],
+ default: Any = None,
+ conformer: Optional[Conformer] = None,
+) -> Spec:
+ """
+ Return a Spec which will validate every value, but which will conform values not
+ meeting the Spec to a default value.
+
+ The returned Spec is equivalent to the following Spec:
+
+ `s.any(spec, s.every(conformer=lambda _: default)`
+
+ This Spec **will allow any value to pass**, but will conform to the given default
+ if the data does not satisfy the input Spec.
+
+ :param tag: an optional tag for the resulting spec
+ :param pred: a Spec or value which can be converted into a Spec
+ :param default: the default value to apply if the Spec does not validate a value
+ :param conformer: an optional conformer for the value
+ :return: a Spec which validates every value, but which conforms values to a default
+ """
+ tag, preds = _tag_maybe(*args) # pylint: disable=no-value-for-parameter
+ assert len(preds) == 1, "Only one predicate allowed"
+ return any_spec(
+ tag or "default", # type: ignore
+ preds[0], # type: ignore
+ every_spec(conformer=lambda _: default),
+ conformer=conformer,
+ )
+
+
def every_spec(
tag: Optional[Tag] = None, conformer: Optional[Conformer] = None
) -> Spec:
diff --git a/tox.ini b/tox.ini
index 55d62b2..b7dec87 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,7 +3,7 @@ envlist = {py36,py37,py38}{-dateutil,-phonenumbers,},coverage,format,mypy,lint,s
[testenv]
deps =
- coverage
+ coverage==4.5.4
dateutil: python-dateutil
phonenumbers: phonenumbers
;; PyTest 5.2.3 created a situation where coverage.py collected no results
@@ -22,7 +22,7 @@ commands =
depends = py36,py37,py38
deps =
coveralls
- coverage
+ coverage==4.5.4
passenv = COVERALLS_REPO_TOKEN
setenv =
; Disable PEP 517 behavior since we're using usedevelop = true
@@ -66,7 +66,7 @@ commands =
[testenv:mypy]
deps = mypy
commands =
- mypy --config-file={toxinidir}/mypy.ini {toxinidir}/src/
+ mypy --show-error-codes --config-file={toxinidir}/mypy.ini {toxinidir}/src/
[testenv:lint]
deps =
| coverahealth/dataspec | 21b1850683d8b2737c4d8114c8c7a5b7d948d911 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index 0b271ee..8523c44 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -203,6 +203,22 @@ def test_is_any(v):
assert s.is_any.is_valid(v)
+class TestBlankableSpecValidation:
+ @pytest.fixture
+ def blankable_spec(self) -> Spec:
+ return s.blankable(s.str(regex=r"\d{5}"))
+
+ @pytest.mark.parametrize("v", ["", "11111", "12345"])
+ def test_blankable_validation(self, blankable_spec: Spec, v):
+ assert blankable_spec.is_valid(v)
+
+ @pytest.mark.parametrize(
+ "v", [" ", "1234", "1234D", " 12345", None, {}, set(), []]
+ )
+ def test_blankable_validation_failure(self, blankable_spec: Spec, v):
+ assert not blankable_spec.is_valid(v)
+
+
class TestBoolValidation:
@pytest.mark.parametrize("v", [True, False])
def test_bool(self, v):
@@ -338,6 +354,59 @@ class TestBytesSpecValidation:
s.bytes(minlength=10, maxlength=8)
+class TestDefaultSpecValidation:
+ @pytest.fixture
+ def default_spec(self) -> Spec:
+ return s.default(s.str(regex=r"\d{5}"))
+
+ @pytest.mark.parametrize(
+ "v",
+ [
+ " ",
+ "1234",
+ "1234D",
+ " 12345",
+ None,
+ {},
+ set(),
+ [],
+ "",
+ "11111",
+ "12345",
+ ],
+ )
+ def test_default_validation(self, default_spec: Spec, v):
+ assert default_spec.is_valid(v)
+
+
+class TestDefaultSpecConformation:
+ @pytest.fixture
+ def default_spec(self) -> Spec:
+ return s.default(
+ s.str(regex=r"\d{5}", conformer=lambda v: v[:2] + "-" + v[2:]), default=""
+ )
+
+ @pytest.mark.parametrize(
+ "v,conformed",
+ [
+ (" ", ""),
+ ("1234", ""),
+ ("1234D", ""),
+ (" 12345", ""),
+ (None, ""),
+ ({}, ""),
+ (set(), ""),
+ ([], ""),
+ ("", ""),
+ ("11111", "11-111"),
+ ("12345", "12-345"),
+ ],
+ )
+ def test_default_conformation(self, default_spec: Spec, v, conformed):
+ assert default_spec.is_valid(v)
+ assert conformed == default_spec.conform(v)
+
+
class TestEmailSpecValidation:
@pytest.mark.parametrize(
"spec_kwargs",
| `s.blankable` for optional string values
For optional object-type values, `dataspec` includes `s.nilable`. These values may be _either_ a value conforming to their input Spec, _or_ `None`. However, stringly-typed Specs don't have an equivalent utility factory.
`dataspec` should have `s.blankable` which is allows values either matching the input Spec or the empty string. | 0.0 | 21b1850683d8b2737c4d8114c8c7a5b7d948d911 | [
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[11111]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[12345]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234D]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[None]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v5]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v6]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v7]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234D]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[None]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v5]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v6]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v7]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[11111]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[12345]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234D-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[None-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v5-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v6-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v7-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[11111-11-111]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[12345-12-345]"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_0]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[3.14]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[None]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v2]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_0]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[3.14-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[-10--10]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_0]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[8.14-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[-5--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs5]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[2003-01-14",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[0994-12-31",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[994-12-31]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[2000-13-20]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[1984-09-32]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[84-10-4]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[23:18:22]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[11:40:72]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[06:89:13]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[2003-01-14-parsed0]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[0994-12-31-parsed1]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[994-12-31]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[2000-13-20]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[1984-09-32]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[84-10-4]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_date_spec_with_time_fails",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[01:41:16-parsed0]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[08:00:00-parsed1]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[23:18:22]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[11:40:72]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[06:89:13]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_time_spec_with_date_fails",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj32]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj48]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj58]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::test_nilable[None]",
"tests/test_factories.py::test_nilable[]",
"tests/test_factories.py::test_nilable[a",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2019-12-19 20:07:13+00:00 | mit | 1,712 |
|
coverahealth__dataspec-55 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index a35155c..26d754a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Add `SpecPredicate` and `tag_maybe` to the public interface (#49)
+### Fixed
+- Predicates decorated by `pred_to_validator` will now properly be converted into
+ validator specs (#54)
+
## [v0.2.4] - 2019-12-19
### Added
- Add `s.blankable` Spec for specifying optional string values (#45)
diff --git a/README.md b/README.md
index 7ee2125..d59c11a 100644
--- a/README.md
+++ b/README.md
@@ -112,6 +112,44 @@ spec.is_valid("4716df50-0aa0-4b7d-98a4-1f2b2bcb1c6b") # True
spec.is_valid("b4e9735a-ee8c-11e9-8708-4c327592fea9") # False
```
+### Validator Specs
+
+Simple predicates make fine specs, but are unable to provide more details to the caller
+about exactly why the input value failed to validate. Validator specs directly yield
+`ErrorDetails` objects which can indicate more precisely why the input data is failing
+to validate.
+
+```python
+def _is_positive_int(v: Any) -> Iterable[ErrorDetails]:
+ if not isinstance(v, int):
+ yield ErrorDetails(
+ message="Value must be an integer", pred=_is_positive_int, value=v
+ )
+ elif v < 1:
+ yield ErrorDetails(
+ message="Number must be greater than 0", pred=_is_positive_int, value=v
+ )
+
+spec = s(_is_positive_int)
+spec.is_valid(5) # True
+spec.is_valid(0.5) # False
+spec.validate_ex(-1) # ValidationError(errors=[ErrorDetails(message="Number must be greater than 0", ...)])
+```
+
+Simple predicates can be converted into validator functions using the builtin
+`pred_to_validator` decorator:
+
+```python
+@pred_to_validator("Number must be greater than 0")
+def _is_positive_num(v: Union[int, float]) -> bool:
+ return v > 0
+
+spec = s(_is_positive_num)
+spec.is_valid(5) # True
+spec.is_valid(0.5) # True
+spec.validate_ex(-1) # ValidationError(errors=[ErrorDetails(message="Number must be greater than 0", ...)])
+```
+
### UUID Specs
In the previous section, we used a simple predicate to check that a UUID was a certain
@@ -397,6 +435,24 @@ All Specs can be created with optional tags, specified as a string in the first
positional argument of any spec creation function. Tags are useful for providing
useful names for specs in debugging and validation messages.
+## Patterns
+
+### Factories
+
+Often when validating documents such as a CSV or a JSON blob, you'll find yourself
+writing a series of similar specs again and again. In situations like these, it is
+recommended to create a factory function for generating specs consistently. `dataspec`
+uses this pattern for many of the common spec types described above. This encourages
+reuse of commonly used specs and should help enforce consistency across your domain.
+
+### Reuse
+
+Specs are designed to be immutable, so they may be reused in many different contexts.
+Often, the only the that changes between uses is the tag or conformer. Specs provide a
+convenient API for generating copies of themselves (not modifying the original) which
+update only the relevant attribute. Additionally, Specs can be combined in many useful
+ways to avoid having to redefine common validations repeatedly.
+
## License
MIT License
diff --git a/src/dataspec/base.py b/src/dataspec/base.py
index b46fedd..5c9915e 100644
--- a/src/dataspec/base.py
+++ b/src/dataspec/base.py
@@ -677,6 +677,7 @@ def pred_to_validator(
value=v,
)
+ validator.is_validator_fn = True # type: ignore
return validator
return to_validator
@@ -731,7 +732,9 @@ def make_spec( # pylint: disable=inconsistent-return-statements
# Some builtins may not be inspectable
sig = None
- if sig is not None and sig.return_annotation is Iterator[ErrorDetails]:
+ if (
+ sig is not None and sig.return_annotation is Iterator[ErrorDetails]
+ ) or getattr(pred, "is_validator_fn", False):
return ValidatorSpec(
tag or pred.__name__, cast(ValidatorFn, pred), conformer=conformer
)
| coverahealth/dataspec | cc1879448aac512d1da4003c427e12bd1a793f10 | diff --git a/tests/test_api.py b/tests/test_api.py
index f80a7eb..b5c19a5 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -3,7 +3,7 @@ from typing import Iterator
import pytest
from dataspec import ErrorDetails, ValidationError, s
-from dataspec.base import PredicateSpec, ValidatorSpec
+from dataspec.base import PredicateSpec, ValidatorSpec, pred_to_validator
class TestSpecConstructor:
@@ -34,6 +34,13 @@ class TestSpecConstructor:
assert isinstance(s(is_valid), PredicateSpec)
+ def test_pred_to_validator(self):
+ @pred_to_validator("This value is invalid")
+ def is_valid(v) -> bool:
+ return bool(v)
+
+ assert isinstance(s(is_valid), ValidatorSpec)
+
def test_no_signature_for_builtins(self):
s.all(s.str(), str.istitle)
| Predicates decorated by `pred_to_validator` are not properly converted into Validator Specs
```python
from dataspec import s, pred_to_validator
>>> @pred_to_validator("This value is invalid")
... def is_valid(v) -> bool:
... return bool(v)
...
>>> spec = s(is_valid)
>>> spec
PredicateSpec(tag='is_valid', _pred=<function is_valid at 0x109a09b70>, _conformer=None)
```
This created workarounds requiring people to import `ValidatorSpec` from `dataspec.base`. | 0.0 | cc1879448aac512d1da4003c427e12bd1a793f10 | [
"tests/test_api.py::TestSpecConstructor::test_pred_to_validator"
]
| [
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[None]",
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[5]",
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[3.14]",
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[8j]",
"tests/test_api.py::TestSpecConstructor::test_spec_with_no_pred",
"tests/test_api.py::TestSpecConstructor::test_validator_spec",
"tests/test_api.py::TestSpecConstructor::test_predicate_spec",
"tests/test_api.py::TestSpecConstructor::test_no_signature_for_builtins",
"tests/test_api.py::TestFunctionSpecs::test_arg_specs",
"tests/test_api.py::TestFunctionSpecs::test_kwarg_specs",
"tests/test_api.py::TestFunctionSpecs::test_return_spec"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-04-10 17:57:36+00:00 | mit | 1,713 |
|
coverahealth__dataspec-56 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26d754a..19f8470 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Predicates decorated by `pred_to_validator` will now properly be converted into
validator specs (#54)
+- Apply conformers for `s.inst`, `s.date`, `s.time`, `s.inst_str`, and `s.phone` after
+ the default conformer, so conformers have access to the conformed object (#50)
## [v0.2.4] - 2019-12-19
### Added
diff --git a/src/dataspec/base.py b/src/dataspec/base.py
index 5c9915e..877b918 100644
--- a/src/dataspec/base.py
+++ b/src/dataspec/base.py
@@ -223,7 +223,7 @@ class ValidatorSpec(Spec):
yield from spec.validate(v)
return cls(
- tag, do_validate, compose_conformers(*specs, conform_final=conformer)
+ tag, do_validate, compose_spec_conformers(*specs, conform_final=conformer)
)
@@ -590,7 +590,28 @@ def _enrich_errors(
yield error.with_details(tag, loc=loc)
-def compose_conformers(
+def compose_conformers(*conformers: Conformer) -> Conformer:
+ """
+ Return a single conformer which is the composition of the input conformers.
+
+ If a single conformer is given, return the conformer.
+ """
+
+ if len(conformers) == 1:
+ return conformers[0]
+
+ def do_conform(v):
+ conformed_v = v
+ for conform in conformers:
+ conformed_v = conform(conformed_v)
+ if conformed_v is INVALID:
+ break
+ return conformed_v
+
+ return do_conform
+
+
+def compose_spec_conformers(
*specs: Spec, conform_final: Optional[Conformer] = None
) -> Conformer:
"""
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index 149a497..5c6a6b9 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -40,6 +40,7 @@ from dataspec.base import (
ValidatorFn,
ValidatorSpec,
compose_conformers,
+ compose_spec_conformers,
make_spec,
pred_to_validator,
)
@@ -167,7 +168,7 @@ def all_spec(*preds: SpecPredicate, conformer: Optional[Conformer] = None) -> Sp
return ValidatorSpec(
tag or "all",
_all_valid,
- conformer=compose_conformers(*specs, conform_final=conformer),
+ conformer=compose_spec_conformers(*specs, conform_final=conformer),
)
@@ -561,7 +562,9 @@ def _make_datetime_spec_factory( # noqa: MC0001
return ValidatorSpec(
tag or type.__name__,
validate_datetime_str,
- conformer=conformer or conform_datetime_str,
+ conformer=compose_conformers(
+ conform_datetime_str, *filter(None, (conformer,))
+ ),
)
else:
return ValidatorSpec.from_validators(
@@ -648,7 +651,12 @@ else:
yield from dt_spec.validate(parsed_dt)
return ValidatorSpec.from_validators(
- tag, is_str, str_contains_datetime, conformer=conformer or parse_date
+ tag,
+ is_str,
+ str_contains_datetime,
+ conformer=compose_conformers(
+ cast(Conformer, parse_date_str), *filter(None, (conformer,))
+ ),
)
@@ -982,7 +990,7 @@ else:
region: Optional[str] = None,
is_possible: bool = True,
is_valid: bool = True,
- conformer: Optional[Conformer] = conform_phonenumber,
+ conformer: Optional[Conformer] = None,
) -> Spec:
"""
Return a Spec that validates strings containing telephone number in most
@@ -1026,6 +1034,7 @@ else:
"""
tag = tag or "phonenumber_str"
+ default_conformer = conform_phonenumber
@pred_to_validator(f"Value '{{value}}' is not type 'str'", complement=True)
def is_str(x: Any) -> bool:
@@ -1054,8 +1063,7 @@ else:
validators.append(validate_phonenumber_region)
- if conformer is conform_phonenumber:
- conformer = partial(conform_phonenumber, region=region)
+ default_conformer = partial(default_conformer, region=region)
if is_possible:
@@ -1094,7 +1102,12 @@ else:
yield from validate_phonenumber(p)
return ValidatorSpec.from_validators(
- tag, is_str, str_contains_phonenumber, conformer=conformer
+ tag,
+ is_str,
+ str_contains_phonenumber,
+ conformer=compose_conformers(
+ default_conformer, *filter(None, (conformer,))
+ ),
)
| coverahealth/dataspec | f65a48f0e3f80ccae3fe7492ca20f1689fb4fd27 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index 8523c44..efd8288 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -656,6 +656,18 @@ class TestInstSpecValidation:
assert not aware_spec.is_valid(datetime.utcnow())
+class TestInstSpecConformation:
+ @pytest.fixture
+ def year_spec(self) -> Spec:
+ return s.inst(format_="%Y-%m-%d %I:%M:%S", conformer=lambda inst: inst.year)
+
+ @pytest.mark.parametrize(
+ "inst,year", [("2003-01-14 01:41:16", 2003), ("0994-12-31 08:00:00", 994),],
+ )
+ def test_conformer(self, year_spec: Spec, inst: datetime, year: int):
+ assert year == year_spec.conform(inst)
+
+
class TestDateSpecValidation:
@pytest.mark.parametrize(
"v", [date(year=2000, month=1, day=1), datetime(year=2000, month=1, day=1)]
@@ -771,6 +783,27 @@ class TestDateSpecValidation:
s.date(is_aware=True)
+class TestDateSpecConformation:
+ @pytest.fixture
+ def year_spec(self) -> Spec:
+ return s.date(format_="%Y-%m-%d", conformer=lambda dt: dt.year)
+
+ @pytest.mark.parametrize(
+ "dtstr, year",
+ [
+ ("1980-01-15", 1980),
+ ("1980-1-15", 1980),
+ ("1999-12-31", 1999),
+ ("2000-1-1", 2000),
+ ("2000-1-01", 2000),
+ ("2000-01-1", 2000),
+ ("2000-01-01", 2000),
+ ],
+ )
+ def test_conformer(self, year_spec: Spec, dtstr: str, year: int):
+ assert year == year_spec.conform(dtstr)
+
+
class TestTimeSpecValidation:
@pytest.mark.parametrize("v", [time()])
def test_is_time(self, v):
@@ -899,6 +932,18 @@ class TestTimeSpecValidation:
assert not aware_spec.is_valid(time())
+class TestTimeSpecConformation:
+ @pytest.fixture
+ def hour_spec(self) -> Spec:
+ return s.time(format_="%H:%M:%S", conformer=lambda tm: tm.hour)
+
+ @pytest.mark.parametrize(
+ "tmstr,hour", [("23:18:22", 23), ("11:40:22", 11), ("06:43:13", 6)],
+ )
+ def test_conformer(self, hour_spec: Spec, tmstr: str, hour: int):
+ assert hour == hour_spec.conform(tmstr)
+
+
@pytest.mark.skipif(parse_date is None, reason="python-dateutil must be installed")
class TestInstStringSpecValidation:
ISO_DATETIMES = [
@@ -916,7 +961,9 @@ class TestInstStringSpecValidation:
("0031-01-01T00:00:00", datetime(31, 1, 1, 0, 0)),
("20080227T21:26:01.123456789", datetime(2008, 2, 27, 21, 26, 1, 123456)),
("0003-03-04", datetime(3, 3, 4)),
- ("950404 122212", datetime(1995, 4, 4, 12, 22, 12)),
+ ]
+ ISO_ONLY_DATETIMES = [
+ ("950404 122212", datetime(9504, 4, 1, 22, 12)),
]
NON_ISO_DATETIMES = [
("Thu Sep 25 10:36:28 2003", datetime(2003, 9, 25, 10, 36, 28)),
@@ -964,13 +1011,18 @@ class TestInstStringSpecValidation:
("13NOV2017", datetime(2017, 11, 13)),
("December.0031.30", datetime(31, 12, 30)),
]
+ NON_ISO_ONLY_DATETIMES = [
+ ("950404 122212", datetime(1995, 4, 4, 12, 22, 12)),
+ ]
ALL_DATETIMES = ISO_DATETIMES + NON_ISO_DATETIMES
@pytest.fixture
def inst_str_spec(self) -> Spec:
return s.inst_str()
- @pytest.mark.parametrize("date_str,datetime_obj", ALL_DATETIMES)
+ @pytest.mark.parametrize(
+ "date_str,datetime_obj", ALL_DATETIMES + NON_ISO_ONLY_DATETIMES
+ )
def test_inst_str_validation(self, inst_str_spec: Spec, date_str, datetime_obj):
assert inst_str_spec.is_valid(date_str)
assert datetime_obj == inst_str_spec.conform(date_str)
@@ -986,7 +1038,9 @@ class TestInstStringSpecValidation:
def iso_inst_str_spec(self) -> Spec:
return s.inst_str(iso_only=True)
- @pytest.mark.parametrize("date_str,datetime_obj", ISO_DATETIMES)
+ @pytest.mark.parametrize(
+ "date_str,datetime_obj", ISO_DATETIMES + ISO_ONLY_DATETIMES
+ )
def test_iso_inst_str_validation(
self, iso_inst_str_spec: Spec, date_str, datetime_obj
):
| Alternate conformers replace default conformers
In lots of builtin Spec factories, alternate conformers (passed via `conformer=...` keyword argument to the Spec factory) will overwrite the existing default conformers, which often apply useful logic (in the case of `s.date(format_="...")` the conformer will convert the value into a date, which is a desirable value for custom conformers).
In an example case, suppose you want to create a Spec which conforms a date from a string and then creates a datetime with a default time. You might think you could do this:
```python
s.date(
format_="%m%d%Y",
conformer=lambda d: datetime(d.year, d.month, d.day, 20)
)
```
But in fact, `d` will be a string since the default conformer for `s.date` was overwritten when a new conformer was supplied. So users will be forced to come up with a concoction like this:
```python
s.all(
s.date(format_="%m%d%Y"),
s.every(
conformer=lambda d: datetime(d.year, d.month, d.day, 20)
),
)
```
...or perhaps include the logic in their custom conformer. | 0.0 | f65a48f0e3f80ccae3fe7492ca20f1689fb4fd27 | [
"tests/test_factories.py::TestInstSpecConformation::test_conformer[2003-01-14",
"tests/test_factories.py::TestInstSpecConformation::test_conformer[0994-12-31",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1980-01-15-1980]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1980-1-15-1980]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1999-12-31-1999]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-1-1-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-1-01-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-01-1-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-01-01-2000]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[23:18:22-23]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[11:40:22-11]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[06:43:13-6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_0]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[3.14]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[None]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v2]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_0]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[3.14-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[-10--10]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_0]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[8.14-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[-5--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[11111]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[12345]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234D]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[None]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v5]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v6]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v7]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234D]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[None]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v5]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v6]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v7]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[11111]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[12345]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234D-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[None-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v5-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v6-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v7-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[11111-11-111]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[12345-12-345]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs5]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[2003-01-14",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[0994-12-31",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[994-12-31]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[2000-13-20]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[1984-09-32]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[84-10-4]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[23:18:22]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[11:40:72]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[06:89:13]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[2003-01-14-parsed0]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[0994-12-31-parsed1]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[994-12-31]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[2000-13-20]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[1984-09-32]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[84-10-4]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_date_spec_with_time_fails",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[01:41:16-parsed0]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[08:00:00-parsed1]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[23:18:22]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[11:40:72]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[06:89:13]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_time_spec_with_date_fails",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj16]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj47]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj56]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::test_nilable[None]",
"tests/test_factories.py::test_nilable[]",
"tests/test_factories.py::test_nilable[a",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-04-10 19:14:29+00:00 | mit | 1,714 |
|
coverahealth__dataspec-59 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index e0668e0..b31b0fb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
-
+### Added
+- Add `s.dict_tag` as a convenience factory for building mapping specs for which
+ the value spec tags are derived automatically from the corresponding dict keys (#52)
## [v0.2.5] - 2020-04-10
### Added
diff --git a/src/dataspec/__version__.py b/src/dataspec/__version__.py
index caef129..a165b7d 100644
--- a/src/dataspec/__version__.py
+++ b/src/dataspec/__version__.py
@@ -1,3 +1,3 @@
-VERSION = (0, 2, 5)
+VERSION = (0, 3, "dev0")
__version__ = ".".join(map(str, VERSION))
diff --git a/src/dataspec/api.py b/src/dataspec/api.py
index bc594ca..050aecc 100644
--- a/src/dataspec/api.py
+++ b/src/dataspec/api.py
@@ -18,6 +18,7 @@ from dataspec.factories import (
date_spec,
datetime_spec,
default_spec,
+ dict_tag_spec,
email_spec,
every_spec,
nilable_spec,
@@ -107,6 +108,7 @@ class SpecAPI:
bytes = staticmethod(bytes_spec)
date = staticmethod(date_spec)
default = staticmethod(default_spec)
+ dict_tag = staticmethod(dict_tag_spec)
email = staticmethod(email_spec)
every = staticmethod(every_spec)
inst = staticmethod(datetime_spec)
diff --git a/src/dataspec/base.py b/src/dataspec/base.py
index 877b918..cbbcfed 100644
--- a/src/dataspec/base.py
+++ b/src/dataspec/base.py
@@ -740,10 +740,11 @@ def make_spec( # pylint: disable=inconsistent-return-statements
elif isinstance(pred, dict):
return DictSpec.from_val(tag, pred, conformer=conformer)
elif isinstance(pred, Spec):
+ if tag is not None:
+ pred = pred.with_tag(tag)
if conformer is not None:
- return pred.with_conformer(conformer)
- else:
- return pred
+ pred = pred.with_conformer(conformer)
+ return pred
elif isinstance(pred, type):
return type_spec(tag, pred, conformer=conformer)
elif callable(pred):
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index 5c6a6b9..2bded83 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -179,7 +179,7 @@ def blankable_spec(
Return a Spec which will validate values either by the input Spec or allow the
empty string.
- The returned Spec is equivalent to `s.any(spec, {""})`.
+ The returned Spec is equivalent to ``s.any(spec, {""})``.
:param tag: an optional tag for the resulting spec
:param pred: a Spec or value which can be converted into a Spec
@@ -660,6 +660,49 @@ else:
)
+def dict_tag_spec(
+ *args: Union[Tag, SpecPredicate], conformer: Optional[Conformer] = None
+) -> Spec:
+ """
+ Return a mapping Spec for which the Tags for each of the ``dict`` values is set
+ to the corresponding key.
+
+ This is a convenience factory for the common pattern of creating a mapping Spec
+ with all of the key Specs' Tags bearing the same name as the corresponding key.
+ The value Specs are created as by :py:data:`dataspec.s`, so existing Specs will
+ not be modified; instead new Specs will be created by
+ :py:meth:`dataspec.Spec.with_tag`.
+
+ For more precise tagging of mapping Spec values, use the default ``s`` constructor
+ with a ``dict`` value.
+
+ :param tag: an optional tag for the resulting spec
+ :param pred: a mapping spec predicate
+ :param conformer: an optional conformer for the value
+ :return: a mapping Spec
+ """
+ tag, preds = tag_maybe(*args) # pylint: disable=no-value-for-parameter
+ if len(preds) > 1:
+ raise ValueError(
+ f"Dict specs may only specify one spec predicate, not {len(preds)}"
+ )
+
+ pred = preds[0]
+ if not isinstance(pred, dict):
+ raise TypeError(f"Dict spec predicate must be a dict, not {type(pred)}")
+
+ def _unwrap_opt_key(k: Union[OptionalKey, str]) -> str:
+ if isinstance(k, OptionalKey):
+ return k.key
+ return k
+
+ return make_spec(
+ *((tag,) if tag is not None else ()),
+ {k: make_spec(_unwrap_opt_key(k), v) for k, v in pred.items()},
+ conformer=conformer,
+ )
+
+
_IGNORE_OBJ_PARAM = object()
_EMAIL_RESULT_FIELDS = frozenset({"username", "domain"})
| coverahealth/dataspec | 2bcd7cfb26b39ad703ac9f5581abb39dfe5c9ff3 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index efd8288..6621bd8 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -6,7 +6,7 @@ from enum import Enum
import pytest
-from dataspec import INVALID, Spec, s
+from dataspec import INVALID, Spec, ValidationError, s
try:
from dateutil.parser import parse as parse_date
@@ -407,6 +407,56 @@ class TestDefaultSpecConformation:
assert conformed == default_spec.conform(v)
+class TestDictTagSpecValidation:
+ def test_invalid_dict_tag_spec(self):
+ with pytest.raises(ValueError):
+ s.dict_tag(
+ "person",
+ {"id": s.str(format_="uuid"), "first_name": s.str()},
+ {"last_name": s.str()},
+ )
+
+ with pytest.raises(ValueError):
+ s.dict_tag(
+ {"id": s.str(format_="uuid"), "first_name": s.str()},
+ {"last_name": s.str()},
+ )
+
+ with pytest.raises(TypeError):
+ s.dict_tag("person", [{"id": s.str(format_="uuid"), "first_name": s.str()}])
+
+ with pytest.raises(TypeError):
+ s.dict_tag([{"id": s.str(format_="uuid"), "first_name": s.str()}])
+
+ @pytest.mark.parametrize(
+ "v,via",
+ [
+ (
+ {"name": "Mark Jones", "license_states": "GA"},
+ ["licensures", "license_states", "coll"],
+ ),
+ (
+ {"name": "Darryl Smith", "license_states": ["NY", "California"]},
+ ["licensures", "license_states", "state", "str_is_exactly_len"],
+ ),
+ ({"name": "GaryBusey"}, ["licensures", "name", "str_matches_regex"]),
+ ],
+ )
+ def test_error_details(self, v, via):
+ try:
+ s.dict_tag(
+ "licensures",
+ {
+ "name": s.str(regex=r"(\w+) (\w+)"),
+ s.opt("license_states"): [s.str("state", length=2)],
+ },
+ ).validate_ex(v)
+ assert False
+ except ValidationError as e:
+ err = e.errors[0]
+ assert via == err.via
+
+
class TestEmailSpecValidation:
@pytest.mark.parametrize(
"spec_kwargs",
| Mapping Specs could default child Spec tags from the dictionary key
Mapping Specs often require repeating the key in the child Spec tag:
```python
s(
"user-profile",
{
"id": s.str("id", format_="uuid"),
"first_name": s.str("first_name"),
"last_name": s.str("last_name"),
"date_of_birth": s.str("date_of_birth", format_="iso-date"),
"gender": s("gender", {"M", "F"}),
s.opt("state"): s.str("state", minlength=2, maxlength=2),
}
)
```
In cases where all child Specs are not defined inline, this makes sense (as you may not necessarily want to change the child Spec's tag to match the dictionary key), but for cases like the above it's quite inconvenient. | 0.0 | 2bcd7cfb26b39ad703ac9f5581abb39dfe5c9ff3 | [
"tests/test_factories.py::TestDictTagSpecValidation::test_invalid_dict_tag_spec",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v0-via0]",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v1-via1]",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v2-via2]"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_0]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[3.14]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[None]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v2]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_0]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[3.14-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[-10--10]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_0]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[8.14-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[-5--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[11111]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[12345]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234D]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[None]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v5]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v6]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v7]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234D]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[None]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v5]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v6]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v7]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[11111]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[12345]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234D-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[None-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v5-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v6-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v7-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[11111-11-111]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[12345-12-345]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs5]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[2003-01-14",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[0994-12-31",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[994-12-31]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[2000-13-20]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[1984-09-32]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[84-10-4]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[23:18:22]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[11:40:72]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[06:89:13]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstSpecConformation::test_conformer[2003-01-14",
"tests/test_factories.py::TestInstSpecConformation::test_conformer[0994-12-31",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[2003-01-14-parsed0]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[0994-12-31-parsed1]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[994-12-31]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[2000-13-20]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[1984-09-32]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[84-10-4]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_date_spec_with_time_fails",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1980-01-15-1980]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1980-1-15-1980]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1999-12-31-1999]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-1-1-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-1-01-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-01-1-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-01-01-2000]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[01:41:16-parsed0]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[08:00:00-parsed1]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[23:18:22]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[11:40:72]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[06:89:13]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_time_spec_with_date_fails",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[23:18:22-23]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[11:40:22-11]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[06:43:13-6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj16]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj47]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj56]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::test_nilable[None]",
"tests/test_factories.py::test_nilable[]",
"tests/test_factories.py::test_nilable[a",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2020-04-12 13:07:34+00:00 | mit | 1,715 |
|
coverahealth__dataspec-62 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2672046..cc15b9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
the value spec tags are derived automatically from the corresponding dict keys (#52)
- Add documentation built using Sphinx and hosted on ReadTheDocs (#9)
+### Fixed
+- Fixed a bug where `s(None)` is not a valid alias for `s(type(None))` (#61)
+
## [v0.2.5] - 2020-04-10
### Added
- Add `SpecPredicate` and `tag_maybe` to the public interface (#49)
diff --git a/docs/usage.rst b/docs/usage.rst
index f0bc885..b25cdc8 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -99,6 +99,10 @@ by simply passing a Python type directly to the ``s`` constructor:
spec.is_valid("a string") # True
spec.is_valid(3) # False
+.. note::
+
+ ``s(None)`` is a shortcut for ``s(type(None))`` .
+
.. _factories_usage:
Factories
diff --git a/src/dataspec/base.py b/src/dataspec/base.py
index f0ca97c..42e4b74 100644
--- a/src/dataspec/base.py
+++ b/src/dataspec/base.py
@@ -494,7 +494,7 @@ class DictSpec(Spec):
)
except TypeError:
yield ErrorDetails(
- message=f"Value is not a mapping type",
+ message="Value is not a mapping type",
pred=self,
value=d,
via=[self.tag],
@@ -771,7 +771,7 @@ def type_spec(
)
-def make_spec( # pylint: disable=inconsistent-return-statements
+def make_spec( # pylint: disable=inconsistent-return-statements # noqa: MC0001
*args: Union[Tag, SpecPredicate], conformer: Optional[Conformer] = None
) -> Spec:
"""
@@ -784,7 +784,9 @@ def make_spec( # pylint: disable=inconsistent-return-statements
be *exactly* ``Iterator[ErrorDetails]`` ).
Specs may be created from Python types, in which case a Spec will be produced
- that performs an :py:func:`isinstance` check.
+ that performs an :py:func:`isinstance` check. :py:obj:`None` may be provided as
+ a shortcut for ``type(None)`` . To specify a nilable value, you should use
+ :py:meth:`dataspec.SpecAPI.nilable` instead.
Specs may be created for enumerated types using a Python ``set`` or ``frozenset``
or using Python :py:class:`enum.Enum` types. Specs created for enumerated types
@@ -820,7 +822,11 @@ def make_spec( # pylint: disable=inconsistent-return-statements
:return: a :py:class:`dataspec.base.Spec` instance
"""
tag = args[0] if isinstance(args[0], str) else None
- pred = args[0] if tag is None else args[1]
+
+ try:
+ pred = args[0] if tag is None else args[1]
+ except IndexError:
+ raise TypeError("Expected some spec predicate; received only a Tag")
if isinstance(pred, (frozenset, set)):
return SetSpec(tag or "set", pred, conformer=conformer)
@@ -861,5 +867,7 @@ def make_spec( # pylint: disable=inconsistent-return-statements
return PredicateSpec(
tag or pred.__name__, cast(PredicateFn, pred), conformer=conformer
)
+ elif pred is None:
+ return type_spec(tag, type(None), conformer=conformer)
else:
raise TypeError(f"Expected some spec predicate; received type {type(pred)}")
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index d1b2474..d8ed31e 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -510,7 +510,7 @@ def _make_datetime_spec_factory( # noqa: MC0001
if type_ is datetime:
@pred_to_validator(
- f"Datetime '{{value}}' is not aware", complement=is_aware
+ "Datetime '{value}' is not aware", complement=is_aware
)
def datetime_is_aware(d: datetime) -> bool:
return d.tzinfo is not None and d.tzinfo.utcoffset(d) is not None
@@ -519,9 +519,7 @@ def _make_datetime_spec_factory( # noqa: MC0001
elif type_ is time:
- @pred_to_validator(
- f"Time '{{value}}' is not aware", complement=is_aware
- )
+ @pred_to_validator("Time '{value}' is not aware", complement=is_aware)
def time_is_aware(t: time) -> bool:
return t.tzinfo is not None and t.tzinfo.utcoffset(None) is not None
@@ -632,7 +630,7 @@ else:
tag = tag or "datetime_str"
- @pred_to_validator(f"Value '{{value}}' is not type 'str'", complement=True)
+ @pred_to_validator("Value '{value}' is not type 'str'", complement=True)
def is_str(x: Any) -> bool:
return isinstance(x, str)
@@ -1079,7 +1077,7 @@ else:
tag = tag or "phonenumber_str"
default_conformer = conform_phonenumber
- @pred_to_validator(f"Value '{{value}}' is not type 'str'", complement=True)
+ @pred_to_validator("Value '{value}' is not type 'str'", complement=True)
def is_str(x: Any) -> bool:
return isinstance(x, str)
@@ -1094,7 +1092,7 @@ else:
country_code = phonenumbers.country_code_for_region(region)
@pred_to_validator(
- f"Parsed telephone number regions ({{value}}) does not "
+ "Parsed telephone number regions ({value}) does not "
f"match expected region {region}",
complement=True,
convert_value=lambda p: ", ".join(
@@ -1111,7 +1109,7 @@ else:
if is_possible:
@pred_to_validator(
- f"Parsed telephone number '{{value}}' is not possible", complement=True
+ "Parsed telephone number '{value}' is not possible", complement=True
)
def validate_phonenumber_is_possible(p: phonenumbers.PhoneNumber) -> bool:
return phonenumbers.is_possible_number(p)
@@ -1121,7 +1119,7 @@ else:
if is_valid:
@pred_to_validator(
- f"Parsed telephone number '{{value}}' is not valid", complement=True
+ "Parsed telephone number '{value}' is not valid", complement=True
)
def validate_phonenumber_is_valid(p: phonenumbers.PhoneNumber) -> bool:
return phonenumbers.is_valid_number(p)
@@ -1199,7 +1197,7 @@ def _str_is_uuid(s: str) -> Iterator[ErrorDetails]:
uuid.UUID(s)
except ValueError:
yield ErrorDetails(
- message=f"String does not contain UUID", pred=_str_is_uuid, value=s
+ message="String does not contain UUID", pred=_str_is_uuid, value=s
)
@@ -1211,7 +1209,7 @@ if sys.version_info >= (3, 7):
date.fromisoformat(s)
except ValueError:
yield ErrorDetails(
- message=f"String does not contain ISO formatted date",
+ message="String does not contain ISO formatted date",
pred=_str_is_iso_date,
value=s,
)
@@ -1222,7 +1220,7 @@ if sys.version_info >= (3, 7):
datetime.fromisoformat(s)
except ValueError:
yield ErrorDetails(
- message=f"String does not contain ISO formatted datetime",
+ message="String does not contain ISO formatted datetime",
pred=_str_is_iso_datetime,
value=s,
)
@@ -1233,7 +1231,7 @@ if sys.version_info >= (3, 7):
time.fromisoformat(s)
except ValueError:
yield ErrorDetails(
- message=f"String does not contain ISO formatted time",
+ message="String does not contain ISO formatted time",
pred=_str_is_iso_time,
value=s,
)
@@ -1335,7 +1333,7 @@ def str_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
:return: a Spec which validates strings
"""
- @pred_to_validator(f"Value '{{value}}' is not a string", complement=True)
+ @pred_to_validator("Value '{value}' is not a string", complement=True)
def is_str(s: Any) -> bool:
return isinstance(s, str)
@@ -1516,7 +1514,7 @@ def url_str_spec(
:return: a Spec which can validate that a string contains a URL
"""
- @pred_to_validator(f"Value '{{value}}' is not a string", complement=True)
+ @pred_to_validator("Value '{value}' is not a string", complement=True)
def is_str(s: Any) -> bool:
return isinstance(s, str)
@@ -1560,7 +1558,7 @@ def url_str_spec(
raise ValueError(f"Unused keyword arguments: {kwargs}")
if query_spec is None and not child_validators:
- raise ValueError(f"URL specs must include at least one validation rule")
+ raise ValueError("URL specs must include at least one validation rule")
def validate_parse_result(v: ParseResult) -> Iterator[ErrorDetails]:
for validate in child_validators:
@@ -1611,7 +1609,7 @@ def uuid_spec(
:return: a Spec which validates UUIDs
"""
- @pred_to_validator(f"Value '{{value}}' is not a UUID", complement=True)
+ @pred_to_validator("Value '{value}' is not a UUID", complement=True)
def is_uuid(v: Any) -> bool:
return isinstance(v, uuid.UUID)
@@ -1622,7 +1620,7 @@ def uuid_spec(
if not {1, 3, 4, 5}.issuperset(set(versions)):
raise ValueError("UUID versions must be specified as a set of integers")
- @pred_to_validator(f"UUID '{{value}}' is not RFC 4122 variant", complement=True)
+ @pred_to_validator("UUID '{value}' is not RFC 4122 variant", complement=True)
def uuid_is_rfc_4122(v: uuid.UUID) -> bool:
return v.variant is uuid.RFC_4122
| coverahealth/dataspec | 6cc2c3b5b1f3b78453d3a2bb9ccc86899ff7ca90 | diff --git a/tests/test_api.py b/tests/test_api.py
index b5c19a5..af391e7 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -7,15 +7,11 @@ from dataspec.base import PredicateSpec, ValidatorSpec, pred_to_validator
class TestSpecConstructor:
- @pytest.mark.parametrize("v", [None, 5, 3.14, 8j])
+ @pytest.mark.parametrize("v", [5, 3.14, 8j, "a value"])
def test_invalid_specs(self, v):
with pytest.raises(TypeError):
s(v)
- def test_spec_with_no_pred(self):
- with pytest.raises(IndexError):
- s("string")
-
def test_validator_spec(self):
def is_valid(v) -> Iterator[ErrorDetails]:
if v:
diff --git a/tests/test_base.py b/tests/test_base.py
index f0a45c6..4dc09d6 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -665,6 +665,7 @@ class TestTypeSpec:
@pytest.mark.parametrize(
"tp,vals",
[
+ (None, [None]),
(bool, [True, False]),
(bytes, [b"", b"a", b"bytes"]),
(dict, [{}, {"a": "b"}]),
@@ -683,6 +684,7 @@ class TestTypeSpec:
@pytest.fixture
def python_vals(self):
return [
+ None,
True,
False,
b"",
| `s(None)` throws an exception
```
>>> from dataspec import s
>>> s(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/christopher/Projects/dataspec/src/dataspec/api.py", line 101, in __call__
return make_spec(*args, conformer=conformer)
File "/Users/christopher/Projects/dataspec/src/dataspec/base.py", line 768, in make_spec
raise TypeError(f"Expected some spec predicate; received type {type(pred)}")
TypeError: Expected some spec predicate; received type <class 'NoneType'>
```
This should be a valid alias for `s(type(None))`. | 0.0 | 6cc2c3b5b1f3b78453d3a2bb9ccc86899ff7ca90 | [
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[a",
"tests/test_base.py::TestTypeSpec::test_typecheck[None-vals0]"
]
| [
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[5]",
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[3.14]",
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[8j]",
"tests/test_api.py::TestSpecConstructor::test_validator_spec",
"tests/test_api.py::TestSpecConstructor::test_predicate_spec",
"tests/test_api.py::TestSpecConstructor::test_pred_to_validator",
"tests/test_api.py::TestSpecConstructor::test_no_signature_for_builtins",
"tests/test_api.py::TestFunctionSpecs::test_arg_specs",
"tests/test_api.py::TestFunctionSpecs::test_kwarg_specs",
"tests/test_api.py::TestFunctionSpecs::test_return_spec",
"tests/test_base.py::TestCollSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestCollSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestCollSpecValidation::test_error_details[v2-path2]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_min_minlength[-1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_min_minlength[-100]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll3]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_min_maxlength[-1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_min_maxlength[-100]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_maxlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll3]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll4]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_base.py::TestCollSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[frozenset]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[list]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[set]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[tuple]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[frozenset]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[list]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[set]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[tuple]",
"tests/test_base.py::TestCollSpecConformation::test_coll_conformation",
"tests/test_base.py::TestCollSpecConformation::test_set_coll_conformation",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d0]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d1]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d2]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[None]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[a",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[0]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[3.14]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[True]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[False]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d6]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d7]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d8]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d9]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d10]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d11]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d12]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v2-path2]",
"tests/test_base.py::TestDictSpecConformation::test_dict_conformation",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o0]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o1]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o2]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o0]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o1]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o2]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o3]",
"tests/test_base.py::TestSetSpec::test_set_spec",
"tests/test_base.py::TestSetSpec::test_set_spec_conformation",
"tests/test_base.py::TestEnumSetSpec::test_enum_spec",
"tests/test_base.py::TestEnumSetSpec::test_enum_spec_conformation",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row0]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row1]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row2]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[None]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[a",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[0]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[3.14]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[True]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[False]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row6]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row7]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row8]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row9]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row10]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row11]",
"tests/test_base.py::TestTupleSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestTupleSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestTupleSpecConformation::test_tuple_conformation",
"tests/test_base.py::TestTupleSpecConformation::test_namedtuple_conformation",
"tests/test_base.py::TestTypeSpec::test_typecheck[bool-vals1]",
"tests/test_base.py::TestTypeSpec::test_typecheck[bytes-vals2]",
"tests/test_base.py::TestTypeSpec::test_typecheck[dict-vals3]",
"tests/test_base.py::TestTypeSpec::test_typecheck[float-vals4]",
"tests/test_base.py::TestTypeSpec::test_typecheck[int-vals5]",
"tests/test_base.py::TestTypeSpec::test_typecheck[list-vals6]",
"tests/test_base.py::TestTypeSpec::test_typecheck[set-vals7]",
"tests/test_base.py::TestTypeSpec::test_typecheck[str-vals8]",
"tests/test_base.py::TestTypeSpec::test_typecheck[tuple-vals9]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[bool]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[bytes]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[dict]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[float]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[int]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[list]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[set]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[str]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[tuple]"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-04-14 01:35:57+00:00 | mit | 1,716 |
|
coverahealth__dataspec-63 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index cc15b9a..7339d07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `s.dict_tag` as a convenience factory for building mapping specs for which
the value spec tags are derived automatically from the corresponding dict keys (#52)
- Add documentation built using Sphinx and hosted on ReadTheDocs (#9)
+- Add a `regex` validator to the `s.bytes` factory (#37)
### Fixed
- Fixed a bug where `s(None)` is not a valid alias for `s(type(None))` (#61)
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index d8ed31e..3225790 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -235,6 +235,7 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
length: Optional[int] = None,
minlength: Optional[int] = None,
maxlength: Optional[int] = None,
+ regex: Union[Pattern, bytes, None] = None,
conformer: Optional[Conformer] = None,
) -> Spec:
"""
@@ -255,6 +256,11 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
be raised. If any length value is not an :py:class:`int` a :py:exc:`TypeError`
will be raised.
+ If ``regex`` is specified and is a :py:class:`bytes`, a Regex pattern will be
+ created by :py:func:`re.compile`. If ``regex`` is specified and is a
+ :py:obj:`typing.Pattern`, the supplied pattern will be used. In both cases, the
+ :py:func:`re.fullmatch` will be used to validate input strings.
+
:param tag: an optional tag for the resulting spec
:param type_: a single :py:class:`type` or tuple of :py:class:`type` s which
will be used to type check input values by the resulting Spec
@@ -264,6 +270,8 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
not fewer than ``minlength`` bytes long by :py:func:`len`
:param maxlength: if specified, the resulting Spec will validate that bytes are
not longer than ``maxlength`` bytes long by :py:func:`len`
+ :param regex: if specified, the resulting Spec will validate that strings match
+ the ``regex`` pattern using :py:func:`re.fullmatch`
:param conformer: an optional conformer for the value
:return: a Spec which validates bytes and bytearrays
"""
@@ -330,6 +338,17 @@ def bytes_spec( # noqa: MC0001 # pylint: disable=too-many-arguments
"Cannot define a spec with minlength greater than maxlength"
)
+ if regex is not None:
+ _pattern = regex if isinstance(regex, Pattern) else re.compile(regex)
+
+ @pred_to_validator(
+ "Bytes '{value}' does match regex '{regex}'", complement=True, regex=regex
+ )
+ def bytes_matches_regex(s: str) -> bool:
+ return bool(_pattern.fullmatch(s))
+
+ validators.append(bytes_matches_regex)
+
return ValidatorSpec.from_validators(
tag or "bytes", *validators, conformer=conformer
)
| coverahealth/dataspec | b9d24ea23f7d4ce7d7f52785abad4b90c50449e1 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index 6621bd8..ff211e2 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -346,6 +346,36 @@ class TestBytesSpecValidation:
def test_is_not_maxlength(self, maxlength_spec: Spec, v):
assert not maxlength_spec.is_valid(v)
+ class TestRegexSpec:
+ @pytest.fixture(params=(b"\d{5}(-\d{4})?", re.compile(b"\d{5}(-\d{4})?")))
+ def zipcode_spec(self, request) -> Spec:
+ return s.bytes(regex=request.param)
+
+ @pytest.mark.parametrize(
+ "v", [b"10017", b"10017-3332", b"37779", b"37779-2770", b"00000"]
+ )
+ def test_is_zipcode(self, zipcode_spec: Spec, v):
+ assert zipcode_spec.is_valid(v)
+
+ @pytest.mark.parametrize(
+ "v",
+ [
+ None,
+ 25,
+ 3.14,
+ [],
+ set(),
+ "abcdef",
+ "abcdefg",
+ "100017",
+ "10017-383",
+ b"100017",
+ b"10017-383",
+ ],
+ )
+ def test_is_not_zipcode(self, zipcode_spec: Spec, v):
+ assert not zipcode_spec.is_valid(v)
+
def test_minlength_and_maxlength_agreement(self):
s.bytes(minlength=10, maxlength=10)
s.bytes(minlength=8, maxlength=10)
| `s.bytes` should include regex matching
The Python `re` module allows defining regex patterns on `bytes` types in addition to `str` types, so `s.bytes` should allow defining a regex on bytes. | 0.0 | b9d24ea23f7d4ce7d7f52785abad4b90c50449e1 | [
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-10017]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-37779]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-00000]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-10017]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-37779]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-00000]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-None]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-25]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-100017_0]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-10017-383_0]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-100017_1]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-10017-383_1]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-None]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-25]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-100017_0]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-10017-383_0]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-100017_1]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-10017-383_1]"
]
| [
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_factories.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_factories.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_0]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[5_1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation[3.14]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[None]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v1]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v2]",
"tests/test_factories.py::TestAnySpecValidation::test_any_validation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_0]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[5-5_1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[3.14-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation[-10--10]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_0]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[10-5_1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[8.14-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation[-5--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_conformation_failure[byteword]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected0-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected1-5]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected3--10]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[None]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v1]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v2]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v3]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500x]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[Just",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500]",
"tests/test_factories.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[byteword]",
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[11111]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[12345]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234D]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[None]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v5]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v6]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v7]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234D]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[None]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v5]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v6]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v7]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[11111]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[12345]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234D-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[None-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v5-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v6-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v7-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[11111-11-111]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[12345-12-345]",
"tests/test_factories.py::TestDictTagSpecValidation::test_invalid_dict_tag_spec",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v0-via0]",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v1-via1]",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v2-via2]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs5]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[2003-01-14",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[0994-12-31",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[994-12-31]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[2000-13-20]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[1984-09-32]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[84-10-4]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[23:18:22]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[11:40:72]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[06:89:13]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstSpecConformation::test_conformer[2003-01-14",
"tests/test_factories.py::TestInstSpecConformation::test_conformer[0994-12-31",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[2003-01-14-parsed0]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[0994-12-31-parsed1]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[994-12-31]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[2000-13-20]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[1984-09-32]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[84-10-4]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_date_spec_with_time_fails",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1980-01-15-1980]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1980-1-15-1980]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1999-12-31-1999]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-1-1-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-1-01-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-01-1-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-01-01-2000]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[01:41:16-parsed0]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[08:00:00-parsed1]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[23:18:22]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[11:40:72]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[06:89:13]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_time_spec_with_date_fails",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[23:18:22-23]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[11:40:22-11]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[06:43:13-6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj16]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj47]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj56]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::test_nilable[None]",
"tests/test_factories.py::test_nilable[]",
"tests/test_factories.py::test_nilable[a",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-04-14 01:55:08+00:00 | mit | 1,717 |
|
coverahealth__dataspec-80 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f6fb1e..b2e117f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `Spec.compose_conformer` to allow composition of new conformers with existing
conformers (#65)
- Added `s.merge` to allow seamless merging of mapping Specs (#70)
+- Added `ErrorDetails.as_map` to convert `ErrorDetails` instances to simple dicts (#79)
### Changed
- **Breaking** `Spec.with_conformer` will now replace the default conformer applied
diff --git a/docs/api.rst b/docs/api.rst
index fd112fd..93c074e 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -1,3 +1,5 @@
+.. py:currentmodule:: dataspec
+
.. _api:
Dataspec API
@@ -27,20 +29,52 @@ For more information, see :py:meth:`dataspec.SpecAPI.__call__`.
Types
-----
-.. automodule:: dataspec
- :members: Spec, SpecPredicate, Tag, Conformer, PredicateFn, ValidatorFn
- :noindex:
+.. autoclass:: Spec
+ :members:
+
+.. data:: SpecPredicate
+
+ SpecPredicates are values that can be coerced into Specs by :py:func:`dataspec.s`.
+
+.. data:: Tag
+
+ Tags are string names given to :py:class:`dataspec.Spec` instances which are emitted
+ in :py:class:`dataspec.ErrorDetails` instances to indicate which Spec or Specs were
+ evaluated to produce the error.
+
+.. data:: Conformer
+
+ Conformers are functions of one argument which return either a conformed value or
+ an instance of :py:class:`dataspec.Invalid` (such as :py:obj:`dataspec.INVALID`).
+
+.. data:: PredicateFn
+
+ Predicate functions are functions of one argument which return :py:class:`bool`
+ indicating whether or not the argument is valid or not.
+
+.. data:: ValidatorFn
+
+ Validator functions are functions of one argument which yield successive
+ :py:class:`dataspec.ErrorDetails` instances indicating exactly why input values
+ do not meet the Spec.
.. _spec_errors:
Spec Errors
-----------
-.. automodule:: dataspec
- :members: ErrorDetails, Invalid, ValidationError
- :noindex:
+.. autoclass:: ErrorDetails
+ :members:
+
+.. autoclass:: Invalid
+
+.. autoclass:: ValidationError
+ :members:
+
+.. data:: dataspec.INVALID
-.. autodata:: dataspec.INVALID
+ ``INVALID`` is a singleton instance of :py:class:`dataspec.Invalid` emitted by
+ builtin conformers which can be used for a quick ``is`` identity check.
.. _utilities:
diff --git a/docs/usage.rst b/docs/usage.rst
index 8ac9279..18dcb2c 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -4,7 +4,7 @@ Usage
=====
.. contents::
- :depth: 3
+ :depth: 4
.. _constructing_specs:
@@ -34,6 +34,84 @@ provided in :py:class:`dataspec.ErrorDetails` objects emitted by Spec instance
provided as the first positional argument. Specs are required to have tags and all
builtin Spec factories will supply a default tag if one is not given.
+.. _validation:
+
+Validation
+----------
+
+Once you've :ref:`constructed <constructing_specs>` your Spec, you'll most likely want
+to begin validating data with that Spec. The :py:class:`dataspec.Spec` interface
+provides several different ways to check that your data is valid given your use case.
+
+The simplest way to validate your data is by calling :py:meth:`dataspec.Spec.is_valid`
+which returns a simple boolean :py:obj:`True` if your data is valid and :py:obj:`False`
+otherwise. Of course, that kind of simple yes or no answer may be sufficient in some
+cases, but in other cases you may be more interested in knowing *exactly* why the data
+you provided is invalid. For more complex cases, you can turn to the generator
+:py:meth:`dataspec.Spec.validate` which will emit successive
+:py:class:`dataspec.ErrorDetails` instances describing the errors in your input value.
+
+:py:class:`dataspec.ErrorDetails` instances include comprehensive details about why
+your input data did not meet the Spec, including an error message, the predicate that
+validated it, and the value itself. :py:class:`via <dataspec.ErrorDetails>` is a list
+of all Spec tags that validated your data up to (and including) the error. For nested
+values, the :py:class:`path <dataspec.ErrorDetails>` attribute indicates the indices
+and keys that lead from the input value to the failing value. This detail can be used
+to programmatically emit useful error messages to clients.
+
+.. note::
+
+ For convenience, you can fetch all of the errors at once as a list using
+ :py:meth:`dataspec.Spec.validate_all` or raise an exception with all of the errors
+ using :py:meth:`dataspec.Spec.validate_ex`.
+
+.. warning::
+
+ ``dataspec`` will emit an exhaustive list of every instance where your input data
+ fails to meet the Spec, so if you do not require a full list of errors, you may
+ want to consider using :py:meth:`dataspec.Spec.is_valid` or using the generator
+ method :py:meth:`dataspec.Spec.validate` to fetch errors as needed.
+
+.. _conformation:
+
+Conformation
+------------
+
+Data validation is only one half of the value proposition for using ``dataspec``. After
+you've validated that data is valid, the next step is to normalize it into a canonical
+format. Conformers are functions of one argument that can accept a validated value and
+emit a canonical representation of that value. Conformation is the component of
+``dataspec`` that helps you normalize data.
+
+Every Spec value comes with a default conformer. For most Specs, that conformer simply
+returns the value it was passed, though a few builtin Specs do provide a richer,
+canonicalized version of the input data. For example, :py:meth:`dataspec.SpecAPI.date`
+conforms a date (possibly from a ``strptime`` format string) into a ``date`` object.
+Note that **none** of the builtin Spec conformers ever modify the data they are passed.
+``dataspec`` conformers always create new data structures and return the conformed
+values. Custom conformers can modify their data in-flight, but that is not recommended
+since it will be harder reason about failures (in particular, if a mutating conformer
+appeared in the middle of ``s.all(...)`` Spec and a later Spec produced an error).
+
+Most common Spec workflows will involve validating that your data is, in fact, valid
+using :py:meth:`dataspec.Spec.is_valid` or :py:meth:`dataspec.Spec.validate` for richer
+error details and then calling :py:meth:`dataspec.Spec.conform_valid` if it is valid
+or dealing with the error if not.
+
+.. _user_provided_conformers:
+
+User Provided Conformers
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+When you create Specs, you can always provide a conformer using the ``conformer``
+keyword argument. This function will be called any time you call
+:py:meth:`dataspec.Spec.conform` on your Spec or any Spec your Spec is a part of. The
+``conformer`` keyword argument for :py:func:`dataspec.s` and other builtin factories
+will always apply your conformer as by :py:meth:`dataspec.Spec.compose_conformer` ,
+rather than replacing the default conformer. To have your conformer *completely*
+replace the default conformer (if one is provided), you can use the
+:py:meth:`dataspec.Spec.with_conformer` method on the returned Spec.
+
.. _predicates_and_validators:
Predicate and Validators
@@ -506,40 +584,4 @@ Occasionally, it may be useful to allow any value to pass validation. For these
You may want to combine ``s.every(...)`` with ``s.all(...)`` to perform a pre-
conformation step prior to later steps. In this case, it may still be useful to
provide a slightly more strict validation to ensure your conformer does not throw
- an exception.
-
-Conformation
-------------
-
-Data validation is only one half of the value proposition for using ``dataspec``. After
-you've validated that data is valid, the next step is to normalize it into a canonical
-format. Conformers are functions of one argument that can accept a validated value and
-emit a canonical representation of that value. Conformation is the component of
-``dataspec`` that helps you normalize data.
-
-Every Spec value comes with a default conformer. For most Specs, that conformer simply
-returns the value it was passed, though a few builtin Specs do provide a richer,
-canonicalized version of the input data. For example, :py:meth:`dataspec.SpecAPI.date`
-conforms a date (possibly from a ``strptime`` format string) into a ``date`` object.
-Note that **none** of the builtin Spec conformers ever modify the data they are passed.
-``dataspec`` conformers always create new data structures and return the conformed
-values. Custom conformers can modify their data in-flight, but that is not recommended
-since it will be harder reason about failures (in particular, if a mutating conformer
-appeared in the middle of ``s.all(...)`` Spec and a later Spec produced an error).
-
-Most common Spec workflows will involve validating that your data is, in fact, valid
-using :py:meth:`dataspec.Spec.is_valid` or :py:meth:`dataspec.Spec.validate` for richer
-error details and then calling :py:meth:`dataspec.Spec.conform_valid` if it is valid
-or dealing with the error if not.
-
-User Provided Conformers
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-When you create Specs, you can always provide a conformer using the ``conformer``
-keyword argument. This function will be called any time you call
-:py:meth:`dataspec.Spec.conform` on your Spec or any Spec your Spec is a part of. The
-``conformer`` keyword argument for :py:func:`dataspec.s` and other builtin factories
-will always apply your conformer as by :py:meth:`dataspec.Spec.compose_conformer` ,
-rather than replacing the default conformer. To have your conformer *completely*
-replace the default conformer (if one is provided), you can use the
-:py:meth:`dataspec.Spec.with_conformer` method on the returned Spec.
\ No newline at end of file
+ an exception.
\ No newline at end of file
diff --git a/src/dataspec/base.py b/src/dataspec/base.py
index efe4154..9653ae0 100644
--- a/src/dataspec/base.py
+++ b/src/dataspec/base.py
@@ -125,6 +125,40 @@ class ErrorDetails:
self.path.insert(0, loc)
return self
+ def as_map(self) -> Mapping[str, Union[str, List[str]]]:
+ """
+ Return a map of the fields of this instance converted to strings or a list of
+ strings, suitable for being converted into JSON.
+
+ The :py:attr:`dataspec.ErrorDetails.pred` attribute will be stringified in one
+ of three ways. If ``pred`` is a :py:class:`dataspec.Spec` instance, ``pred``
+ will be converted to the :py:attr:`dataspec.Spec.tag` of that instance. If
+ ``pred`` is a callable (as by :py:func:`callable`) , it will be converted to
+ the ``__name__`` of the callable. Otherwise, ``pred`` will be passed directly
+ to :py:func:`str`.
+
+ ``message`` will remain a string. ``value`` will be passed to :py:func:`str`
+ directly. ``via`` and ``path`` will be returned as a list of strings.
+
+ :return: a mapping of string keys to strings or lists of strings
+ """
+ if isinstance(self.pred, Spec):
+ pred = self.pred.tag
+ elif callable(self.pred):
+ # Lambdas just have the name '<lambda>', but there's not much
+ # we can do about that
+ pred = self.pred.__name__
+ else:
+ pred = str(self.pred)
+
+ return {
+ "message": self.message,
+ "pred": pred,
+ "value": str(self.value),
+ "via": list(self.via),
+ "path": [str(e) for e in self.path],
+ }
+
@attr.s(auto_attribs=True, slots=True)
class ValidationError(Exception):
@@ -172,6 +206,20 @@ class Spec(ABC):
"""
raise NotImplementedError
+ def validate_all(self, v: Any) -> List[ErrorDetails]: # pragma: no cover
+ """
+ Validate the value ``v`` against the Spec, returning a :py:class:`list` of all
+ Spec failures of ``v`` as :py:class:`dataspec.ErrorDetails` instances.
+
+ This method is equivalent to ``list(spec.validate(v))``. If an empty list is
+ returned ``v`` is valid according to the Spec.
+
+ :param v: a value to validate
+ :return: a list of Spec failures as :py:class:`dataspec.ErrorDetails`
+ instances, if any
+ """
+ return list(self.validate(v))
+
def validate_ex(self, v: Any) -> None:
"""
Validate the value ``v`` against the Spec, throwing a
@@ -181,7 +229,7 @@ class Spec(ABC):
:param v: a value to validate
:return: :py:obj:`None`
"""
- errors = list(self.validate(v))
+ errors = self.validate_all(v)
if errors:
raise ValidationError(errors)
| coverahealth/dataspec | 293ba51c6522227f970466411291c893e01e4f82 | diff --git a/tests/test_api.py b/tests/test_api.py
index 873962e..1d11f8f 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -1,3 +1,4 @@
+import re
from typing import Iterator
import pytest
@@ -83,6 +84,45 @@ class TestSpecConformerComposition:
assert INVALID is coll_spec_with_conformer_kwarg.conform(["1", 2, "3"])
+class TestErrorDetails:
+ def test_as_map_with_callable_pred(self):
+ def the_value_is_valid(_):
+ return False
+
+ errors = s(the_value_is_valid).validate_all("something")
+ error = errors[0].as_map()
+ assert isinstance(error["message"], str)
+ assert error["pred"] == "the_value_is_valid"
+ assert error["value"] == "something"
+ assert "the_value_is_valid" in error["via"]
+ assert error["path"] == []
+
+ def test_as_map_with_spec_pred(self):
+ def invalid_validator_spec(_) -> Iterator[ErrorDetails]:
+ raise Exception()
+
+ errors = s("test-validator-spec", invalid_validator_spec).validate_all(
+ "something"
+ )
+ error = errors[0].as_map()
+ assert isinstance(error["message"], str)
+ assert error["pred"] == "test-validator-spec"
+ assert error["value"] == "something"
+ assert "test-validator-spec" in error["via"]
+ assert error["path"] == []
+
+ def test_as_map_with_other_pred(self):
+ errors = s("type-map", {"type": s("a-or-b", {"a", "b"})}).validate_all(
+ {"type": "c"}
+ )
+ error = errors[0].as_map()
+ assert isinstance(error["message"], str)
+ assert error["pred"] in {"{'a', 'b'}", "{'b', 'a'}"}
+ assert error["value"] == "c"
+ assert "a-or-b" in error["via"]
+ assert error["path"] == ["type"]
+
+
class TestFunctionSpecs:
def test_arg_specs(self):
@s.fdef(argpreds=(s.is_num, s.is_num))
| ErrorDetails instance should be easy to convert to dicts
ErrorDetails instances may be emitted to log streams or returned via APIs, so they should include a convenience method for converting to a simple dict. | 0.0 | 293ba51c6522227f970466411291c893e01e4f82 | [
"tests/test_api.py::TestErrorDetails::test_as_map_with_callable_pred",
"tests/test_api.py::TestErrorDetails::test_as_map_with_spec_pred",
"tests/test_api.py::TestErrorDetails::test_as_map_with_other_pred"
]
| [
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[5]",
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[3.14]",
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[8j]",
"tests/test_api.py::TestSpecConstructor::test_invalid_specs[a",
"tests/test_api.py::TestSpecConstructor::test_validator_spec",
"tests/test_api.py::TestSpecConstructor::test_predicate_spec",
"tests/test_api.py::TestSpecConstructor::test_pred_to_validator",
"tests/test_api.py::TestSpecConstructor::test_no_signature_for_builtins",
"tests/test_api.py::TestSpecConstructor::test_no_conformer_default",
"tests/test_api.py::TestSpecConstructor::test_construct_with_existing_spec_replaces_conformer",
"tests/test_api.py::TestSpecConstructor::test_predicate_exception",
"tests/test_api.py::TestSpecConformerComposition::test_spec_compose_conformer_with_no_default_conformer",
"tests/test_api.py::TestSpecConformerComposition::test_spec_compose_conformer_with_default_conformer",
"tests/test_api.py::TestSpecConformerComposition::test_coll_spec_with_outer_conformer_from_kwarg",
"tests/test_api.py::TestFunctionSpecs::test_arg_specs",
"tests/test_api.py::TestFunctionSpecs::test_kwarg_specs",
"tests/test_api.py::TestFunctionSpecs::test_return_spec"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-04-29 14:20:47+00:00 | mit | 1,718 |
|
coverahealth__dataspec-83 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a66036..91cde72 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Previously, Spec factories such as `s.str` would inject tags for child validators
such as `str_matches_regex` into `via`, making it difficult to programmatically
determine which Spec the input value violated (#78)
+- Mapping spec default conformers will now use the same key insertion order as the
+ original mapping spec predicate. Optional keys will now retain their insertion
+ position, rather than being appended at the end of the conformed map. (#82)
### Fixed
- Fixed a bug where `s(None)` is not a valid alias for `s(type(None))` (#61)
diff --git a/src/dataspec/base.py b/src/dataspec/base.py
index 6ff3923..7eb65e9 100644
--- a/src/dataspec/base.py
+++ b/src/dataspec/base.py
@@ -570,16 +570,24 @@ class CollSpec(Spec):
yield from _enrich_errors(self._spec.validate(e), self.tag, i)
+T_hashable = TypeVar("T_hashable", bound=Hashable)
+
+
@attr.s(auto_attribs=True, frozen=True, slots=_USE_SLOTS_FOR_GENERIC)
-class OptionalKey(Generic[T]):
- key: T
+class OptionalKey(Generic[T_hashable]):
+ key: T_hashable
+
+
[email protected](auto_attribs=True, frozen=True, slots=True)
+class _KeySpec:
+ spec: Spec
+ is_optional: bool = False
@attr.s(auto_attribs=True, frozen=True, slots=True)
class DictSpec(Spec):
tag: Tag
- _reqkeyspecs: Mapping[Hashable, Spec] = attr.ib(factory=dict)
- _optkeyspecs: Mapping[Hashable, Spec] = attr.ib(factory=dict)
+ _keyspecs: Mapping[Hashable, _KeySpec] = attr.ib(factory=dict)
conformer: Optional[Conformer] = None
@classmethod
@@ -589,53 +597,55 @@ class DictSpec(Spec):
kvspec: Mapping[Hashable, SpecPredicate],
conformer: Optional[Conformer] = None,
) -> Spec:
- reqkeys = {}
- optkeys: MutableMapping[Any, Spec] = {}
+ keyspecs = {}
for k, v in kvspec.items():
if isinstance(k, OptionalKey):
- if k.key in reqkeys:
- raise KeyError(
- f"Optional key '{k.key}' duplicates key already defined in required keys"
- )
- optkeys[k.key] = make_spec(v)
+ if k.key in keyspecs:
+ raise KeyError(f"Optional key '{k.key}' duplicates existing key")
+ keyspecs[k.key] = _KeySpec(make_spec(v), is_optional=True)
else:
- if k in optkeys:
- raise KeyError(
- f"Required key '{k}' duplicates key already defined in optional keys"
- )
- reqkeys[k] = make_spec(v)
+ if k in keyspecs:
+ raise KeyError(f"Required key '{k}' duplicates existing key")
+ keyspecs[k] = _KeySpec(make_spec(v))
def conform_mapping(d: Mapping) -> Mapping:
conformed_d = {}
- for k, spec in reqkeys.items():
- conformed_d[k] = spec.conform(d[k])
-
- for k, spec in optkeys.items():
- if k in d:
- conformed_d[k] = spec.conform(d[k])
+ for k, keyspec in keyspecs.items():
+ if keyspec.is_optional:
+ if k in d:
+ conformed_d[k] = keyspec.spec.conform(d[k])
+ else:
+ conformed_d[k] = keyspec.spec.conform(d[k])
return conformed_d
return cls(
tag or "map",
- reqkeyspecs=reqkeys,
- optkeyspecs=optkeys,
+ keyspecs=keyspecs,
conformer=compose_conformers(conform_mapping, conformer),
)
def validate(self, d) -> Iterator[ErrorDetails]: # pylint: disable=arguments-differ
try:
- for k, vspec in self._reqkeyspecs.items():
- if k in d:
- yield from _enrich_errors(vspec.validate(d[k]), self.tag, k)
+ for k, keyspec in self._keyspecs.items():
+ if keyspec.is_optional:
+ if k in d:
+ yield from _enrich_errors(
+ keyspec.spec.validate(d[k]), self.tag, k
+ )
else:
- yield ErrorDetails(
- message=f"Mapping missing key {k}",
- pred=vspec,
- value=d,
- via=[self.tag],
- path=[k],
- )
+ if k in d:
+ yield from _enrich_errors(
+ keyspec.spec.validate(d[k]), self.tag, k
+ )
+ else:
+ yield ErrorDetails(
+ message=f"Mapping missing key {k}",
+ pred=keyspec.spec,
+ value=d,
+ via=[self.tag],
+ path=[k],
+ )
except (AttributeError, TypeError):
yield ErrorDetails(
message="Value is not a mapping type",
@@ -645,10 +655,6 @@ class DictSpec(Spec):
)
return
- for k, vspec in self._optkeyspecs.items():
- if k in d:
- yield from _enrich_errors(vspec.validate(d[k]), self.tag, k)
-
# pylint: disable=protected-access
@classmethod
def merge(
@@ -661,11 +667,10 @@ class DictSpec(Spec):
map_pred: MutableMapping[Hashable, List[SpecPredicate]] = defaultdict(list)
for spec in specs:
- for k, pred in spec._reqkeyspecs.items():
- map_pred[k].append(pred)
-
- for k, pred in spec._optkeyspecs.items():
- map_pred[OptionalKey(k)].append(pred)
+ for k, keyspec in spec._keyspecs.items():
+ map_pred[OptionalKey(k) if keyspec.is_optional else k].append(
+ keyspec.spec
+ )
return cls.from_val(
tag or f"merge-of-{'-'.join(spec.tag for spec in specs)}",
| coverahealth/dataspec | 2fba98a61212d5d731551f1aed0d07f4a887feb8 | diff --git a/tests/test_base.py b/tests/test_base.py
index a8185c2..0834554 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -400,23 +400,35 @@ class TestDictSpecConformation:
s.opt("date_of_birth"): s.str(
"date_of_birth", format_="iso-date", conformer=fromisoformat
),
+ "favorite_color": {"Red", "Green", "Blue"},
}
)
def test_dict_conformation(self, dict_spec: Spec):
conformed = dict_spec.conform(
- {"first_name": "chris", "last_name": "rink", "date_of_birth": "1990-01-14"}
+ {
+ "first_name": "chris",
+ "last_name": "rink",
+ "date_of_birth": "1990-01-14",
+ "favorite_color": "Blue",
+ }
)
assert isinstance(conformed, dict)
assert "Chris" == conformed["first_name"]
assert "Rink" == conformed["last_name"]
assert date(year=1990, month=1, day=14) == conformed["date_of_birth"]
+ assert ["first_name", "last_name", "date_of_birth", "favorite_color"] == list(
+ conformed.keys()
+ )
- conformed = dict_spec.conform({"first_name": "peter", "last_name": "criss"})
+ conformed = dict_spec.conform(
+ {"first_name": "peter", "last_name": "criss", "favorite_color": "Red"}
+ )
assert isinstance(conformed, dict)
assert "Peter" == conformed["first_name"]
assert "Criss" == conformed["last_name"]
assert None is conformed.get("date_of_birth")
+ assert ["first_name", "last_name", "favorite_color"] == list(conformed.keys())
class TestKVSpecValidation:
| Keys marked with `s.opt` in a mapping Spec will be out of order after conformation
The default conformer for mapping Specs using `s.opt` always places optional keys at the end of the conformed map. No one should be relying on the ordering of the conformed keys, but it may still be worthwhile to preserve that key order since Python dicts preserve it. | 0.0 | 2fba98a61212d5d731551f1aed0d07f4a887feb8 | [
"tests/test_base.py::TestDictSpecConformation::test_dict_conformation"
]
| [
"tests/test_base.py::TestCollSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestCollSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestCollSpecValidation::test_error_details[v2-path2]",
"tests/test_base.py::TestCollSpecValidation::test_coll_spec_kwargs[kwargs0]",
"tests/test_base.py::TestCollSpecValidation::test_coll_spec_kwargs[kwargs1]",
"tests/test_base.py::TestCollSpecValidation::test_coll_spec_kwargs[kwargs2]",
"tests/test_base.py::TestCollSpecValidation::TestAllowStr::test_allow_str_validation",
"tests/test_base.py::TestCollSpecValidation::TestAllowStr::test_kind_validation_failure",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_min_minlength[-1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_min_minlength[-100]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_int_minlength[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestMinlengthValidation::test_minlength_spec_failure[coll3]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_min_maxlength[-1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_min_maxlength[-100]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_int_maxlength[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestMaxlengthValidation::test_maxlength_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_maxlength_spec[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll2]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll3]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_spec_failure[coll4]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_base.py::TestCollSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_base.py::TestCollSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[frozenset]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[list]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[set]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation[tuple]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[frozenset]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[list]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[set]",
"tests/test_base.py::TestCollSpecValidation::TestKindValidation::test_kind_validation_failure[tuple]",
"tests/test_base.py::TestCollSpecConformation::test_coll_conformation",
"tests/test_base.py::TestCollSpecConformation::test_set_coll_conformation",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_definition[pred0]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_definition[pred1]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d0]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d1]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec[d2]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[None]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[a",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[0]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[3.14]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[True]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[False]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d6]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d7]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d8]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d9]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d10]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d11]",
"tests/test_base.py::TestDictSpecValidation::test_dict_spec_failure[d12]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestDictSpecValidation::test_error_details[v2-path2]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_definition[args0]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_definition[args1]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_definition[args2]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec[d0]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec[d1]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec[d2]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[None]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[a",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[0]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[3.14]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[True]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[False]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[d6]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[d7]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[d8]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[d9]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[d10]",
"tests/test_base.py::TestKVSpecValidation::test_kv_spec_failure[d11]",
"tests/test_base.py::TestKVSpecConformation::test_kv_spec_conformation[orig0-conformed0]",
"tests/test_base.py::TestKVSpecConformation::test_kv_spec_conformation[orig1-conformed1]",
"tests/test_base.py::TestKVSpecConformation::test_kv_spec_conformation[orig2-conformed2]",
"tests/test_base.py::TestKVSpecConformation::test_kv_spec_conform_keys_conformation[orig0-conformed0]",
"tests/test_base.py::TestKVSpecConformation::test_kv_spec_conform_keys_conformation[orig1-conformed1]",
"tests/test_base.py::TestKVSpecConformation::test_kv_spec_conform_keys_conformation[orig2-conformed2]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_definition_with_duplicate_keys[pred0]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_definition_with_duplicate_keys[pred1]",
"tests/test_base.py::TestObjectSpecValidation::test_object_spec_construction",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o0]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o1]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec[o2]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o0]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o1]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o2]",
"tests/test_base.py::TestObjectSpecValidation::test_obj_spec_failure[o3]",
"tests/test_base.py::TestObjectSpecValidation::test_missing_and_optional_attrs",
"tests/test_base.py::TestSetSpec::test_set_spec",
"tests/test_base.py::TestSetSpec::test_set_spec_conformation",
"tests/test_base.py::TestEnumSetSpec::test_enum_spec",
"tests/test_base.py::TestEnumSetSpec::test_enum_spec_conformation",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row0]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row1]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec[row2]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[None]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[a",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[0]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[3.14]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[True]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[False]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row6]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row7]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row8]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row9]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row10]",
"tests/test_base.py::TestTupleSpecValidation::test_tuple_spec_failure[row11]",
"tests/test_base.py::TestTupleSpecValidation::test_error_details[v0-path0]",
"tests/test_base.py::TestTupleSpecValidation::test_error_details[v1-path1]",
"tests/test_base.py::TestTupleSpecConformation::test_tuple_conformation",
"tests/test_base.py::TestTupleSpecConformation::test_namedtuple_conformation",
"tests/test_base.py::TestAllSpecConstruction::test_all_spec_must_have_pred",
"tests/test_base.py::TestAllSpecConstruction::test_passthrough_spec",
"tests/test_base.py::TestAllSpecValidation::test_all_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_base.py::TestAllSpecValidation::test_all_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[5_0]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[abcde]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[ABCDe]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[5_1]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[3.14]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[None]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[v10]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[v11]",
"tests/test_base.py::TestAllSpecValidation::test_all_failure[v12]",
"tests/test_base.py::TestAllSpecConformation::test_all_spec_conformation[yes-YesNo.YES]",
"tests/test_base.py::TestAllSpecConformation::test_all_spec_conformation[Yes-YesNo.YES]",
"tests/test_base.py::TestAllSpecConformation::test_all_spec_conformation[yES-YesNo.YES]",
"tests/test_base.py::TestAllSpecConformation::test_all_spec_conformation[YES-YesNo.YES]",
"tests/test_base.py::TestAllSpecConformation::test_all_spec_conformation[no-YesNo.NO]",
"tests/test_base.py::TestAllSpecConformation::test_all_spec_conformation[No-YesNo.NO]",
"tests/test_base.py::TestAllSpecConformation::test_all_spec_conformation[nO-YesNo.NO]",
"tests/test_base.py::TestAllSpecConformation::test_all_spec_conformation[NO-YesNo.NO]",
"tests/test_base.py::TestAnySpecConstruction::test_any_spec_must_have_pred",
"tests/test_base.py::TestAnySpecConstruction::test_passthrough_spec",
"tests/test_base.py::TestAnySpecValidation::test_any_validation[5_0]",
"tests/test_base.py::TestAnySpecValidation::test_any_validation[5_1]",
"tests/test_base.py::TestAnySpecValidation::test_any_validation[3.14]",
"tests/test_base.py::TestAnySpecValidation::test_any_validation_failure[None]",
"tests/test_base.py::TestAnySpecValidation::test_any_validation_failure[v1]",
"tests/test_base.py::TestAnySpecValidation::test_any_validation_failure[v2]",
"tests/test_base.py::TestAnySpecValidation::test_any_validation_failure[v3]",
"tests/test_base.py::TestAnySpecConformation::test_conformation[5-5_0]",
"tests/test_base.py::TestAnySpecConformation::test_conformation[5-5_1]",
"tests/test_base.py::TestAnySpecConformation::test_conformation[3.14-3.14]",
"tests/test_base.py::TestAnySpecConformation::test_conformation[-10--10]",
"tests/test_base.py::TestAnySpecConformation::test_conformation_failure[None]",
"tests/test_base.py::TestAnySpecConformation::test_conformation_failure[v1]",
"tests/test_base.py::TestAnySpecConformation::test_conformation_failure[v2]",
"tests/test_base.py::TestAnySpecConformation::test_conformation_failure[v3]",
"tests/test_base.py::TestAnySpecConformation::test_conformation_failure[500x]",
"tests/test_base.py::TestAnySpecConformation::test_conformation_failure[Just",
"tests/test_base.py::TestAnySpecConformation::test_conformation_failure[500]",
"tests/test_base.py::TestAnySpecConformation::test_conformation_failure[byteword]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation[expected0-5]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation[expected1-5]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation[expected3--10]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation_failure[None]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation_failure[v1]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation_failure[v2]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation_failure[v3]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation_failure[500x]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation_failure[Just",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation_failure[500]",
"tests/test_base.py::TestAnySpecConformation::test_tagged_conformation_failure[byteword]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation[10-5_0]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation[10-5_1]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation[8.14-3.14]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation[-5--10]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation_failure[None]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation_failure[v1]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation_failure[v2]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation_failure[v3]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation_failure[500x]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation_failure[Just",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation_failure[500]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_conformation_failure[byteword]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected0-5]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected1-5]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected2-3.14]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation[expected3--10]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[None]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v1]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v2]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[v3]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500x]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[Just",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[500]",
"tests/test_base.py::TestAnySpecWithOuterConformation::test_tagged_conformation_failure[byteword]",
"tests/test_base.py::TestMergeSpecConstruction::test_merge_spec_must_have_pred",
"tests/test_base.py::TestMergeSpecConstruction::test_passthrough_spec",
"tests/test_base.py::TestMergeSpecConstruction::test_must_all_be_mapping_specs",
"tests/test_base.py::TestMergeSpecConstruction::test_allow_overlapping_required_and_optional",
"tests/test_base.py::TestMergeSpecConstruction::test_no_overlapping_required_and_optional",
"tests/test_base.py::TestMergeSpecValidation::test_merge_validation[v0]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_validation[v1]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[5_0]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[abcde]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[ABCDe]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[5_1]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[3.14]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[None]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[v7]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[v8]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[v9]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[v10]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[v11]",
"tests/test_base.py::TestMergeSpecValidation::test_merge_failure[v12]",
"tests/test_base.py::TestTypeSpec::test_typecheck[None-vals0]",
"tests/test_base.py::TestTypeSpec::test_typecheck[bool-vals1]",
"tests/test_base.py::TestTypeSpec::test_typecheck[bytes-vals2]",
"tests/test_base.py::TestTypeSpec::test_typecheck[dict-vals3]",
"tests/test_base.py::TestTypeSpec::test_typecheck[float-vals4]",
"tests/test_base.py::TestTypeSpec::test_typecheck[int-vals5]",
"tests/test_base.py::TestTypeSpec::test_typecheck[list-vals6]",
"tests/test_base.py::TestTypeSpec::test_typecheck[set-vals7]",
"tests/test_base.py::TestTypeSpec::test_typecheck[str-vals8]",
"tests/test_base.py::TestTypeSpec::test_typecheck[tuple-vals9]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[bool]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[bytes]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[dict]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[float]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[int]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[list]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[set]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[str]",
"tests/test_base.py::TestTypeSpec::test_typecheck_failure[tuple]"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-05-06 13:04:01+00:00 | mit | 1,719 |
|
coverahealth__dataspec-88 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7e2d058..e1705c1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+### Fixed
+- Fixed a bug where nilable and blankable Spec conformers would return `INVALID` even
+ if their validation passed (#87)
## [v0.3.post1]
Fixed `README.rst` reference and content-type in `setup.py` for PyPI description.
diff --git a/src/dataspec/__version__.py b/src/dataspec/__version__.py
index 8365ceb..085fffc 100644
--- a/src/dataspec/__version__.py
+++ b/src/dataspec/__version__.py
@@ -1,3 +1,3 @@
-VERSION = (0, 3, "post1")
+VERSION = (0, 3, "dev2")
__version__ = ".".join(map(str, VERSION))
diff --git a/src/dataspec/factories.py b/src/dataspec/factories.py
index a42822f..c8518f0 100644
--- a/src/dataspec/factories.py
+++ b/src/dataspec/factories.py
@@ -92,10 +92,15 @@ def blankable_spec(
message=f"Value '{e}' is not blank", pred=blank_or_pred, value=e,
)
+ def conform_blankable(e):
+ if e == "":
+ return e
+ return spec.conform(e)
+
return ValidatorSpec(
tag or "blankable",
blank_or_pred,
- conformer=compose_conformers(spec.conformer, conformer),
+ conformer=compose_conformers(conform_blankable, conformer),
)
@@ -873,10 +878,15 @@ def nilable_spec(
message=f"Value '{e}' is not None", pred=nil_or_pred, value=e,
)
+ def conform_nilable(e):
+ if e is None:
+ return e
+ return spec.conform(e)
+
return ValidatorSpec(
tag or "nilable",
nil_or_pred,
- conformer=compose_conformers(spec.conformer, conformer),
+ conformer=compose_conformers(conform_nilable, conformer),
)
| coverahealth/dataspec | 8643fb012521db1e3633b4b12c445b750bc70868 | diff --git a/tests/test_factories.py b/tests/test_factories.py
index b532cfe..6b49918 100644
--- a/tests/test_factories.py
+++ b/tests/test_factories.py
@@ -53,6 +53,17 @@ class TestBlankableSpecValidation:
assert blankable_spec.validate_all(v)
+class TestBlankableSpecConformation:
+ @pytest.fixture
+ def blankable_spec(self) -> Spec:
+ return s.blankable(s.date("date", format_="%Y%m%d", conformer=str))
+
+ @pytest.mark.parametrize("v,conformed", [("", ""), ("20200314", "2020-03-14")])
+ def test_blankable_conformation(self, blankable_spec: Spec, v, conformed):
+ assert blankable_spec.is_valid(v)
+ assert conformed == blankable_spec.conform(v)
+
+
class TestBoolValidation:
@pytest.mark.parametrize("v", [True, False])
def test_bool(self, v):
@@ -1008,6 +1019,17 @@ class TestNilableSpecValidation:
assert nilable_spec.validate_all(v)
+class TestNilableSpecConformation:
+ @pytest.fixture
+ def nilable_spec(self) -> Spec:
+ return s.nilable(s.date("date", format_="%Y%m%d", conformer=str))
+
+ @pytest.mark.parametrize("v,conformed", [(None, None), ("20200314", "2020-03-14")])
+ def test_blankable_conformation(self, nilable_spec: Spec, v, conformed):
+ assert nilable_spec.is_valid(v)
+ assert conformed == nilable_spec.conform(v)
+
+
class TestNumSpecValidation:
@pytest.mark.parametrize("v", [-3, 25, 3.14, -2.72, -33])
def test_is_num(self, v):
| Blankable and nilable spec conformers can return INVALID even when validation passes
Due to some changes in #81 to `s.blankable` and `s.nilable`, default conformers for both spec types can return `INVALID` even if the validation logic considers the input value valid.
```
>>> from dataspec import s
>>> spec = s.blankable(s.all("8_digit_date", s.str(length=8), s.date("date", format_="%Y%m%d", conformer=str)))
>>> spec.validate_all("")
[]
>>> spec.conform("")
<dataspec.base.Invalid object at 0x103f4dd68>
``` | 0.0 | 8643fb012521db1e3633b4b12c445b750bc70868 | [
"tests/test_factories.py::TestBlankableSpecConformation::test_blankable_conformation[-]",
"tests/test_factories.py::TestNilableSpecConformation::test_blankable_conformation[None-None]"
]
| [
"tests/test_factories.py::test_is_any[None]",
"tests/test_factories.py::test_is_any[25]",
"tests/test_factories.py::test_is_any[3.14]",
"tests/test_factories.py::test_is_any[3j]",
"tests/test_factories.py::test_is_any[v4]",
"tests/test_factories.py::test_is_any[v5]",
"tests/test_factories.py::test_is_any[v6]",
"tests/test_factories.py::test_is_any[v7]",
"tests/test_factories.py::test_is_any[abcdef]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_spec_construction",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[11111]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation[12345]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[1234D]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[None]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v5]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v6]",
"tests/test_factories.py::TestBlankableSpecValidation::test_blankable_validation_failure[v7]",
"tests/test_factories.py::TestBlankableSpecConformation::test_blankable_conformation[20200314-2020-03-14]",
"tests/test_factories.py::TestBoolValidation::test_bool[True]",
"tests/test_factories.py::TestBoolValidation::test_bool[False]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[]",
"tests/test_factories.py::TestBoolValidation::test_bool_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_false",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[False]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[1]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[0]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[]",
"tests/test_factories.py::TestBoolValidation::test_is_true_failure[a",
"tests/test_factories.py::TestBoolValidation::test_is_true",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[\\xf0\\x9f\\x98\\x8f]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[25]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[None]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v3]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[v4]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[]",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[a",
"tests/test_factories.py::TestBytesSpecValidation::test_not_is_bytes[\\U0001f60f]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_min_count[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_int_count[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[xxy]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[773]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec[833]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[x]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_spec_failure[xxxxx]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestBytesSpecValidation::TestLengthValidation::test_length_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-10017]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-37779]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?0-00000]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-10017]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-37779]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_zipcode[\\d{5}(-\\d{4})?1-00000]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-None]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-25]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-100017_0]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-10017-383_0]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-100017_1]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?0-10017-383_1]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-None]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-25]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-3.14]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-v3]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-v4]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-abcdef]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-100017_0]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-10017-383_0]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-100017_1]",
"tests/test_factories.py::TestBytesSpecValidation::TestRegexSpec::test_is_not_zipcode[\\d{5}(-\\d{4})?1-10017-383_1]",
"tests/test_factories.py::TestBytesSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_spec_construction",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[1234D]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[None]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v5]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v6]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[v7]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[11111]",
"tests/test_factories.py::TestDefaultSpecValidation::test_default_validation[12345]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[1234D-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[None-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v5-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v6-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[v7-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[-]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[11111-11-111]",
"tests/test_factories.py::TestDefaultSpecConformation::test_default_conformation[12345-12-345]",
"tests/test_factories.py::TestDictTagSpecValidation::test_invalid_dict_tag_spec",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v0-via0]",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v1-via1]",
"tests/test_factories.py::TestDictTagSpecValidation::test_error_details[v2-via2]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_invalid_email_specs[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_email_str[spec_kwargs5]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs0]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs1]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs2]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs3]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs4]",
"tests/test_factories.py::TestEmailSpecValidation::test_is_not_email_str[spec_kwargs5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst[v0]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[None]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[25]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3.14]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[3j]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v4]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v5]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v6]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v7]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[abcdef]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v9]",
"tests/test_factories.py::TestInstSpecValidation::test_is_inst_failure[v10]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[2003-01-14",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_inst_spec[0994-12-31",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[994-12-31]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[2000-13-20]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[1984-09-32]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[84-10-4]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[23:18:22]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[11:40:72]",
"tests/test_factories.py::TestInstSpecValidation::TestFormatSpec::test_is_not_inst_spec[06:89:13]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec[v3]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestInstSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestInstSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestInstSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestInstSpecConformation::test_conformer[2003-01-14",
"tests/test_factories.py::TestInstSpecConformation::test_conformer[0994-12-31",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v0]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date[v1]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[None]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[25]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3.14]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[3j]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v4]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v5]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v6]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v7]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[abcdef]",
"tests/test_factories.py::TestDateSpecValidation::test_is_date_failure[v9]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[2003-01-14-parsed0]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_date_spec[0994-12-31-parsed1]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[994-12-31]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[2000-13-20]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[1984-09-32]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_is_not_date_spec[84-10-4]",
"tests/test_factories.py::TestDateSpecValidation::TestFormatSpec::test_date_spec_with_time_fails",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec[v3]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestDateSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestDateSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestDateSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1980-01-15-1980]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1980-1-15-1980]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[1999-12-31-1999]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-1-1-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-1-01-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-01-1-2000]",
"tests/test_factories.py::TestDateSpecConformation::test_conformer[2000-01-01-2000]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time[v0]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[None]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[25]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3.14]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[3j]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v4]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v5]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v6]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v7]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[abcdef]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v9]",
"tests/test_factories.py::TestTimeSpecValidation::test_is_time_failure[v10]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[01:41:16-parsed0]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_time_spec[08:00:00-parsed1]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[23:18:22]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[11:40:72]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_is_not_time_spec[06:89:13]",
"tests/test_factories.py::TestTimeSpecValidation::TestFormatSpec::test_time_spec_with_date_fails",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestBeforeSpec::test_before_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec[v2]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v0]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v1]",
"tests/test_factories.py::TestTimeSpecValidation::TestAfterSpec::test_after_spec_failure[v2]",
"tests/test_factories.py::TestTimeSpecValidation::test_before_after_agreement",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec",
"tests/test_factories.py::TestTimeSpecValidation::TestIsAwareSpec::test_aware_spec_failure",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[23:18:22-23]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[11:40:22-11]",
"tests/test_factories.py::TestTimeSpecConformation::test_conformer[06:43:13-6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[199709020908-datetime_obj16]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[19970902090807-datetime_obj17]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09-25-2003-datetime_obj18]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25-09-2003-datetime_obj19]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-2003-datetime_obj20]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10-09-03-datetime_obj21]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003.09.25-datetime_obj22]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09.25.2003-datetime_obj23]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25.09.2003-datetime_obj24]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.2003-datetime_obj25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10.09.03-datetime_obj26]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003/09/25-datetime_obj27]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09/25/2003-datetime_obj28]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25/09/2003-datetime_obj29]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/2003-datetime_obj30]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10/09/03-datetime_obj31]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[7-4-76-datetime_obj47]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[13NOV2017-datetime_obj56]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[December.0031.30-datetime_obj57]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49:41-datetime_obj0]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10:49-datetime_obj1]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25T10-datetime_obj2]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25-datetime_obj3]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T104941-datetime_obj4]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T1049-datetime_obj5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925T10-datetime_obj6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20030925-datetime_obj7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[2003-09-25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[19760704-datetime_obj9]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0099-01-01T00:00:00-datetime_obj10]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0031-01-01T00:00:00-datetime_obj11]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[20080227T21:26:01.123456789-datetime_obj12]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[0003-03-04-datetime_obj13]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation[950404",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[abcde]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Tue",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3.14]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[None]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v6]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v7]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[v8]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Thu",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[199709020908]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[19970902090807]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09-25-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10-09-03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003.09.25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09.25.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10.09.03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003/09/25]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09/25/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/2003]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10/09/03]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[2003",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[09",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[25",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[03",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Wed,",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1996.July.10",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[July",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[4",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[7-4-76]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[0:01:02",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Mon",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[04.04.95",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[Jan",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[3rd",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[5th",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[1st",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[13NOV2017]",
"tests/test_factories.py::TestInstStringSpecValidation::test_iso_inst_str_validation_failure[December.0031.30]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_spec_construction",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation[None]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation[11111]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation[12345]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation_failure[]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation_failure[",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation_failure[1234]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation_failure[1234D]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation_failure[v5]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation_failure[v6]",
"tests/test_factories.py::TestNilableSpecValidation::test_nilable_validation_failure[v7]",
"tests/test_factories.py::TestNilableSpecConformation::test_blankable_conformation[20200314-2020-03-14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-3]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[25]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[3.14]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-2.72]",
"tests/test_factories.py::TestNumSpecValidation::test_is_num[-33]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[4j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[6j]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[a",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[\\U0001f60f]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[None]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v6]",
"tests/test_factories.py::TestNumSpecValidation::test_not_is_num[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_above_min[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[v7]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMinSpec::test_is_not_above_min[abcd]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[-50]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4.9]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[4]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[0]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[3.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_below_max[5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[None]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[100]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[300.14]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[5.83838828283]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v5]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[v6]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[a]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[ab]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abc]",
"tests/test_factories.py::TestNumSpecValidation::TestMaxSpec::test_is_not_below_max[abcd]",
"tests/test_factories.py::TestNumSpecValidation::test_min_and_max_agreement",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[US]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[uS]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[us]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[GB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[Gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gB]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[gb]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[DE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[dE]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_regions[De]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[USA]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[usa]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[america]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[ZZ]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[zz]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_regions[FU]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[9175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[+19175555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[1-917-555-5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917.555.5555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_valid_phone_number[917",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[None]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[-50]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4.9]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[4]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[0]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[3.14]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v6]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[v7]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[+1917555555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[(917)",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[1-917-555-555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917.555.555]",
"tests/test_factories.py::TestPhoneNumberStringSpecValidation::test_invalid_phone_number[917",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[]",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[a",
"tests/test_factories.py::TestStringSpecValidation::test_is_str[\\U0001f60f]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[25]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[None]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[3.14]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v3]",
"tests/test_factories.py::TestStringSpecValidation::test_not_is_str[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_min_count[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_int_count[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[xxy]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[773]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec[833]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[x]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_spec_failure[xxxxx]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::TestCountValidation::test_count_and_minlength_or_maxlength_agreement[opts2]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_min_minlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_int_minlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_minlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMinlengthSpec::test_is_not_minlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-1]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_min_maxlength[-100]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[-0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[0.5]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_int_maxlength[2.71]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[a]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[ab]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abc]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcd]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_maxlength[abcde]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[None]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[25]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v3]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[v4]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestMaxlengthSpec::test_is_not_maxlength[abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::test_minlength_and_maxlength_agreement",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?0-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-3332]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-37779-2770]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_zipcode[\\\\d{5}(-\\\\d{4})?1-00000]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?0-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-None]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-25]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-3.14]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v3]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-v4]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdef]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-abcdefg]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-100017]",
"tests/test_factories.py::TestStringSpecValidation::TestRegexSpec::test_is_not_zipcode[\\\\d{5}(-\\\\d{4})?1-10017-383]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts0]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts1]",
"tests/test_factories.py::TestStringSpecValidation::test_regex_and_format_agreement[opts2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_date_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODateFormat::test_is_not_date_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14T18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_datetime_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISODatetimeFormat::test_is_not_datetime_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03.335-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_time_str[18:03:50.617332-00:00]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[10017-383]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-9-2]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[430-10-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[2019-10-12]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1945-09-02]",
"tests/test_factories.py::TestStringFormatValidation::TestISOTimeFormat::test_is_not_time_str[1066-10-14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f0-7567-4569-a61d-02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[91d7e5f075674569a61d02ed57507f47]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[06130510-83A5-478B-B65C-6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_uuid_str[0613051083A5478BB65C6A8DC2104E2F]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[None]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[25]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[3.14]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v3]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[v4]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdef]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[abcdefg]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[100017]",
"tests/test_factories.py::TestStringFormatValidation::TestUUIDFormat::test_is_not_uuid_str[10017-383]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_specs[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url_spec_argument_types[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[None]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[25]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[3.14]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v3]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v4]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v5]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[v6]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[]",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_url[//[coverahealth.com]",
"tests/test_factories.py::TestURLSpecValidation::test_valid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_invalid_query_str",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_url_str[spec_kwargs22]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs0]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs1]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs2]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs3]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs4]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs5]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs6]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs7]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs8]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs9]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs10]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs11]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs12]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs13]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs14]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs15]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs16]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs17]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs18]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs19]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs20]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs21]",
"tests/test_factories.py::TestURLSpecValidation::test_is_not_url_str[spec_kwargs22]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v7]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v8]",
"tests/test_factories.py::TestUUIDSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_invalid_uuid_version_spec[versions2]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[6281d852-ef4d-11e9-9002-4c327592fea9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[c5a28680-986f-4f0d-8187-80d1fbe22059]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation[3BE59FF6-9C75-4027-B132-C9792D84547D]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[0e8d7ceb-56e8-36d2-9b54-ea48d4bdea3f]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[10988ff4-136c-5ca7-ab35-a686a56c22c4]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_0]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[abcde]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[ABCDe]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[5_1]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[3.14]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[None]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v9]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v10]",
"tests/test_factories.py::TestUUIDSpecValidation::TestUUIDVersionSpecValidation::test_uuid_validation_failure[v11]"
]
| {
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-05-11 14:45:13+00:00 | mit | 1,720 |
|
craffel__mir_eval-374 | diff --git a/mir_eval/sonify.py b/mir_eval/sonify.py
index c3b3cdd..45d059f 100644
--- a/mir_eval/sonify.py
+++ b/mir_eval/sonify.py
@@ -200,13 +200,10 @@ def time_frequency(
# Create the time-varying scaling for the entire time interval by the piano roll
# magnitude and add to the accumulating waveform.
- # FIXME: this logic is broken when length
- # does not match the final sample interval
- output += wave[:length] * gram_interpolator(
- np.arange(
- max(sample_intervals[0][0], 0), min(sample_intervals[-1][-1], length)
- )
- )
+ t_in = max(sample_intervals[0][0], 0)
+ t_out = min(sample_intervals[-1][-1], length)
+ signal = gram_interpolator(np.arange(t_in, t_out))
+ output[t_in:t_out] += wave[: len(signal)] * signal
# Normalize, but only if there's non-zero values
norm = np.abs(output).max()
| craffel/mir_eval | 7997fdf3972f992209eaf144f37c18926fa3c960 | diff --git a/tests/test_sonify.py b/tests/test_sonify.py
index f4afeb7..b41d9a4 100644
--- a/tests/test_sonify.py
+++ b/tests/test_sonify.py
@@ -28,6 +28,8 @@ def test_time_frequency(fs):
fs,
)
assert len(signal) == 10 * fs
+
+ # Make one longer
signal = mir_eval.sonify.time_frequency(
np.random.standard_normal((100, 1000)),
np.arange(1, 101),
@@ -37,6 +39,16 @@ def test_time_frequency(fs):
)
assert len(signal) == 11 * fs
+ # Make one shorter
+ signal = mir_eval.sonify.time_frequency(
+ np.random.standard_normal((100, 1000)),
+ np.arange(1, 101),
+ np.linspace(0, 10, 1000),
+ fs,
+ length=fs * 5,
+ )
+ assert len(signal) == 5 * fs
+
@pytest.mark.parametrize("fs", [8000, 44100])
def test_chroma(fs):
@@ -54,8 +66,6 @@ def test_chroma(fs):
@pytest.mark.parametrize("fs", [8000, 44100])
-# FIXME: #371
[email protected](reason="Skipped until #371 is fixed")
def test_chords(fs):
intervals = np.array([np.arange(10), np.arange(1, 11)]).T
signal = mir_eval.sonify.chords(
| sonify.time_frequency regression
@leighsmith looks like modernizing the tests #370 surfaced a bug in the optimization of time_frequency sonification #355
The bug only seems to show up in the chord sonification, which goes through chord→chroma and chroma→time_frequency. It works fine when `length=None` is used, but when `length` is explicitly passed and different from the end of the last time interval, we end up with a length mismatch at
https://github.com/craffel/mir_eval/blob/57f7c31b120f6135c31207295372e3b67848126d/mir_eval/sonify.py#L190-L191 .
We didn't have this problem before #355 because the length was always precisely determined to using matching `start:end` indices for each time interval.
Since I'm in the midst of revamping all the tests, we're not really in a good place to handle this bugfix as a separate PR yet. If there's an easy fix, I'd like to roll it into #370 so we can merge things in a passing state. Otherwise I might mark that test as a known fail for now and we can come back to it after merging 370. | 0.0 | 7997fdf3972f992209eaf144f37c18926fa3c960 | [
"tests/test_sonify.py::test_chords[8000]",
"tests/test_sonify.py::test_chords[44100]"
]
| [
"tests/test_sonify.py::test_clicks[8000-times0]",
"tests/test_sonify.py::test_clicks[8000-times1]",
"tests/test_sonify.py::test_clicks[44100-times0]",
"tests/test_sonify.py::test_clicks[44100-times1]",
"tests/test_sonify.py::test_time_frequency[8000]",
"tests/test_sonify.py::test_time_frequency[44100]",
"tests/test_sonify.py::test_chroma[8000]",
"tests/test_sonify.py::test_chroma[44100]",
"tests/test_sonify.py::test_chord_x",
"tests/test_sonify.py::test_pitch_contour"
]
| {
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true
} | 2024-03-25 19:55:56+00:00 | mit | 1,721 |
|
craigjmidwinter__total-connect-client-174 | diff --git a/total_connect_client/const.py b/total_connect_client/const.py
index a927fc8..ea43e74 100644
--- a/total_connect_client/const.py
+++ b/total_connect_client/const.py
@@ -22,6 +22,7 @@ class ArmingState(Enum):
ARMED_AWAY_BYPASS = 10202
ARMED_STAY = 10203
ARMED_STAY_OTHER = 10226
+ ARMED_STAY_10230 = 10230 # issue #173
ARMED_STAY_BYPASS = 10204
ARMED_AWAY_INSTANT = 10205
ARMED_AWAY_INSTANT_BYPASS = 10206
@@ -77,6 +78,7 @@ class ArmingState(Enum):
ArmingState.ARMED_STAY_INSTANT_BYPASS,
ArmingState.ARMED_STAY_NIGHT,
ArmingState.ARMED_STAY_OTHER,
+ ArmingState.ARMED_STAY_10230,
)
def is_armed_night(self):
diff --git a/total_connect_client/location.py b/total_connect_client/location.py
index 878329a..891348e 100644
--- a/total_connect_client/location.py
+++ b/total_connect_client/location.py
@@ -277,9 +277,9 @@ class TotalConnectLocation:
self.arming_state = ArmingState(astate)
except ValueError:
LOGGER.error(
- f"unknown ArmingState {astate} in {result}: please report at {PROJECT_URL}/issues"
+ f"unknown location ArmingState {astate} in {result}: please report at {PROJECT_URL}/issues"
)
- raise TotalConnectError(f"unknown ArmingState {astate} in {result}") from None
+ raise TotalConnectError(f"unknown location ArmingState {astate} in {result}") from None
def _update_partitions(self, result):
"""Update partition info from Partitions."""
diff --git a/total_connect_client/partition.py b/total_connect_client/partition.py
index 446544d..0c1b121 100644
--- a/total_connect_client/partition.py
+++ b/total_connect_client/partition.py
@@ -54,5 +54,5 @@ class TotalConnectPartition:
try:
self.arming_state = ArmingState(astate)
except ValueError:
- LOGGER.error(f"unknown ArmingState {astate} in {info}: report at {PROJECT_URL}/issues")
- raise TotalConnectError(f"unknown ArmingState {astate} in {info}") from None
+ LOGGER.error(f"unknown partition ArmingState {astate} in {info}: report at {PROJECT_URL}/issues")
+ raise TotalConnectError(f"unknown partition ArmingState {astate} in {info}") from None
| craigjmidwinter/total-connect-client | 1bc255da4ea000e553fe98041154a1b7857c9fbe | diff --git a/tests/const.py b/tests/const.py
index c0f53c9..0bb1d3f 100644
--- a/tests/const.py
+++ b/tests/const.py
@@ -135,6 +135,12 @@ PARTITION_ARMED_AWAY = {
"ArmingState": ArmingState.ARMED_AWAY.value,
}
+PARTITION_ARMED_STAY_10230 = {
+ "PartitionID": 1,
+ "ArmingState": 10230,
+ "PartitionName": "Test_10230",
+}
+
PARTITION_INFO_DISARMED = [PARTITION_DISARMED, PARTITION_DISARMED2]
PARTITION_INFO_ARMED_STAY = [PARTITION_ARMED_STAY]
diff --git a/tests/test_partition.py b/tests/test_partition.py
index b67e729..b2dfcb8 100644
--- a/tests/test_partition.py
+++ b/tests/test_partition.py
@@ -4,7 +4,7 @@ from copy import deepcopy
from unittest.mock import Mock
import pytest
-from const import PARTITION_DETAILS_1, PARTITION_DISARMED
+from const import PARTITION_ARMED_STAY_10230, PARTITION_DETAILS_1, PARTITION_DISARMED
from total_connect_client.client import ArmingHelper
from total_connect_client.exceptions import PartialResponseError, TotalConnectError
@@ -77,3 +77,8 @@ def tests_arming_state():
assert partition.arming_state.is_triggered_fire() is False
assert partition.arming_state.is_triggered_gas() is False
assert partition.arming_state.is_triggered() is False
+
+ # test recreates issue #173
+ partition = TotalConnectPartition(PARTITION_ARMED_STAY_10230, None)
+ assert partition.arming_state.is_armed_home() is True
+
\ No newline at end of file
| unknown ArmingState 10230
Initially reported at https://github.com/home-assistant/core/issues/64303
```txt
unknown ArmingState 10230 in OrderedDict([('PartitionID', 1), ('ArmingState', 10230), ('IsAlarmResponded', False), ('AlarmTriggerTimeLocalized', None), ('PartitionName', 'Main'), ('IsStayArmed', False), ('IsFireEnabled', False), ('IsCommonEnabled', False), ('IsLocked', False), ('IsNewPartition', False), ('IsNightStayEnabled', 0), ('ExitDelayTimer', 0)]);
``` | 0.0 | 1bc255da4ea000e553fe98041154a1b7857c9fbe | [
"tests/test_partition.py::tests_arming_state"
]
| [
"tests/test_partition.py::tests_partition",
"tests/test_partition.py::tests_arm_disarm"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-01-19 04:21:16+00:00 | mit | 1,722 |
|
craigjmidwinter__total-connect-client-203 | diff --git a/RESULT_CODES.md b/RESULT_CODES.md
index 764293c..ba2c2a7 100644
--- a/RESULT_CODES.md
+++ b/RESULT_CODES.md
@@ -19,7 +19,7 @@ ResultCode | ResultData | Notes
-4104 | Failed to Connect with Security System |
-4106 | Invalid user code. Please try again. | When disarming. https://github.com/craigjmidwinter/total-connect-client/issues/85
-4114 | System User Code not available/invalid in Database | https://github.com/craigjmidwinter/total-connect-client/issues/36 Also happens attempting a code for an incorrect location/device.
--4504 | Failed to Bypass Zone | Happens when requesting to bypass a non-existent zone.
+-4504 | Failed to Bypass Zone | Happens when requesting to bypass a non-existent zone, or when trying to bypass a zone than cannot be bypassed (i.e. smoke detector).
-9001 | Authorization Failed to Perform Notification Configuration | Received when trying getAllSensorsMaskStatus
-10026 | Unable to load your scenes, please try syncing your panel in the Locations menu. If your panel is still not connecting, please contact your Security Dealer for support |
-12104 | Automation - We are unable to load your automation devices, please try again or contact your security dealer for support | GetAutomationDeviceStatus with location module flag Automation = 0
diff --git a/pyproject.toml b/pyproject.toml
index c97442d..9b48fb0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta:__legacy__"
[project]
name="total_connect_client"
-version="2023.1"
+version="2023.2"
authors = [
{ name="Craig J. Midwinter", email="[email protected]" },
]
diff --git a/total_connect_client/client.py b/total_connect_client/client.py
index 6122fe7..3d0a28e 100644
--- a/total_connect_client/client.py
+++ b/total_connect_client/client.py
@@ -23,6 +23,7 @@ from .const import ArmType, _ResultCode
from .exceptions import (
AuthenticationError,
BadResultCodeError,
+ FailedToBypassZone,
FeatureNotSupportedError,
InvalidSessionError,
RetryableTotalConnectError,
@@ -179,6 +180,8 @@ class TotalConnectClient:
raise UsercodeInvalid(rc.name, response)
if rc == _ResultCode.FEATURE_NOT_SUPPORTED:
raise FeatureNotSupportedError(rc.name, response)
+ if rc == _ResultCode.FAILED_TO_BYPASS_ZONE:
+ raise FailedToBypassZone(rc.name, response)
raise BadResultCodeError(rc.name, response)
def _send_one_request(self, operation_name, args):
diff --git a/total_connect_client/const.py b/total_connect_client/const.py
index 7b99ec8..ef7495f 100644
--- a/total_connect_client/const.py
+++ b/total_connect_client/const.py
@@ -157,6 +157,7 @@ class _ResultCode(Enum):
BAD_USER_OR_PASSWORD = -50004
INVALID_SESSIONID = -30002
+ FAILED_TO_BYPASS_ZONE = -4504
COMMAND_FAILED = -4502
USER_CODE_UNAVAILABLE = -4114
USER_CODE_INVALID = -4106
diff --git a/total_connect_client/exceptions.py b/total_connect_client/exceptions.py
index c50fdde..824d3a8 100644
--- a/total_connect_client/exceptions.py
+++ b/total_connect_client/exceptions.py
@@ -46,3 +46,7 @@ class UsercodeUnavailable(TotalConnectError):
class ServiceUnavailable(TotalConnectError):
"""The TotalConnect service is unavailable or unreachable."""
+
+
+class FailedToBypassZone(TotalConnectError):
+ """Failed to bypass zone because it is non-existent or it cannot be bypassed."""
diff --git a/total_connect_client/location.py b/total_connect_client/location.py
index 891348e..9646ab3 100644
--- a/total_connect_client/location.py
+++ b/total_connect_client/location.py
@@ -324,5 +324,5 @@ class TotalConnectLocation:
zone = TotalConnectZone(zonedata)
self.zones[zid] = zone
- if zone.is_low_battery() and self.auto_bypass_low_battery:
+ if zone.is_low_battery() and zone.can_be_bypassed and self.auto_bypass_low_battery:
self.zone_bypass(zid)
| craigjmidwinter/total-connect-client | b5ba6870e6a2e6630baaa87c71efeb005114c3fe | diff --git a/tests/test_client_zone_bypass.py b/tests/test_client_zone_bypass.py
index 0deeef3..a546683 100644
--- a/tests/test_client_zone_bypass.py
+++ b/tests/test_client_zone_bypass.py
@@ -8,7 +8,7 @@ from common import create_client
from const import LOCATION_INFO_BASIC_NORMAL
from total_connect_client.const import _ResultCode
-from total_connect_client.exceptions import BadResultCodeError
+from total_connect_client.exceptions import FailedToBypassZone
RESPONSE_ZONE_BYPASS_SUCCESS = {
"ResultCode": _ResultCode.SUCCESS.value,
@@ -17,7 +17,7 @@ RESPONSE_ZONE_BYPASS_SUCCESS = {
# guessing on the response...don't know for sure
RESPONSE_ZONE_BYPASS_FAILURE = {
- "ResultCode": _ResultCode.COMMAND_FAILED.value,
+ "ResultCode": _ResultCode.FAILED_TO_BYPASS_ZONE.value,
"ResultData": "None",
}
@@ -65,7 +65,7 @@ class TestTotalConnectClient(unittest.TestCase):
assert zone.is_bypassed() is False
# try to bypass the zone
- with pytest.raises(BadResultCodeError):
+ with pytest.raises(FailedToBypassZone):
location.zone_bypass("1")
# should not be bypassed
| new result code: failed to bypass zone
In working on the ability to bypass zones, got this error:
Error fetching totalconnect data: ('unknown result code -4504', OrderedDict([('ResultCode', -4504), ('ResultData', 'Failed to Bypass Zone')]))
See https://github.com/home-assistant/core/issues/88186
| 0.0 | b5ba6870e6a2e6630baaa87c71efeb005114c3fe | [
"tests/test_client_zone_bypass.py::TestTotalConnectClient::tests_zone_bypass_failure",
"tests/test_client_zone_bypass.py::TestTotalConnectClient::tests_zone_bypass_success"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2023-02-24 22:14:55+00:00 | mit | 1,723 |
|
craigjmidwinter__total-connect-client-206 | diff --git a/README.md b/README.md
index bafe6cc..12dabd9 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Total-Connect-Client
-Total-Connect-Client is a python client for interacting with the TotalConnect2 alarm system.
+Total-Connect-Client is a python client for interacting with the [TotalConnect2](https://totalconnect2.com) alarm system.
Started by @craigjmidwinter to add alarm support for his personal HomeAssistant set-up, with later contributions from others.
@@ -139,6 +139,6 @@ similar methods on the values of self.locations.
* Previously if the usercodes dictionary was invalid, the DEFAULT_USERCODE
was silently used. In a future release, we will raise an exception on an invalid dictionary.
-If there's something about the interface you don't understand, check out the (Home Assistant integration)[https://github.com/home-assistant/core/blob/dev/homeassistant/components/totalconnect/] that uses this package, or submit an issue here.
+If there's something about the interface you don't understand, check out the [Home Assistant integration](https://github.com/home-assistant/core/blob/dev/homeassistant/components/totalconnect/) that uses this package, or [submit an issue](https://github.com/craigjmidwinter/total-connect-client/issues).
-During development, if you discover new status codes or other information not handled, please submit an issue to let us know, or even better submit a pull request.
+During development, if you discover new status codes or other information not handled, please [submit an issue](https://github.com/craigjmidwinter/total-connect-client/issues) to let us know, or even better submit a [pull request](https://github.com/craigjmidwinter/total-connect-client/pulls).
diff --git a/pyproject.toml b/pyproject.toml
index 9b48fb0..a9da19a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta:__legacy__"
[project]
name="total_connect_client"
-version="2023.2"
+version="2023.4"
authors = [
{ name="Craig J. Midwinter", email="[email protected]" },
]
diff --git a/total_connect_client/location.py b/total_connect_client/location.py
index 4b999c4..f5cc2ba 100644
--- a/total_connect_client/location.py
+++ b/total_connect_client/location.py
@@ -255,10 +255,11 @@ class TotalConnectLocation:
"ZoneStatusInfoWithPartitionId"
)
if not zone_info:
- raise PartialResponseError("no ZoneStatusInfoWithPartitionId", result)
-
- for zonedata in zone_info:
- self.zones[zonedata["ZoneID"]] = TotalConnectZone(zonedata)
+ LOGGER.warning("No zones found when starting TotalConnect. Try to sync your panel using the TotalConnect app or website.")
+ LOGGER.debug(f"_update_zone_details result: {result}")
+ else:
+ for zonedata in zone_info:
+ self.zones[zonedata["ZoneID"]] = TotalConnectZone(zonedata)
def _update_status(self, result):
"""Update from result."""
| craigjmidwinter/total-connect-client | 746ec69379f4fe650e9318bb991673989f5a3ac0 | diff --git a/tests/test_client_misc.py b/tests/test_client_misc.py
index 2da74fd..0390414 100644
--- a/tests/test_client_misc.py
+++ b/tests/test_client_misc.py
@@ -21,7 +21,6 @@ from total_connect_client.zone import ZoneStatus
from total_connect_client.exceptions import (
BadResultCodeError,
- PartialResponseError,
TotalConnectError,
)
@@ -77,5 +76,4 @@ class TestTotalConnectClient(unittest.TestCase):
self.location.get_zone_details()
# third response is SUCCESS but with empty ZoneStatus
# ...which we've seen before in the wild
- with pytest.raises(PartialResponseError):
- self.location.get_zone_details()
+ self.location.get_zone_details()
diff --git a/tests/test_location.py b/tests/test_location.py
index 2986b60..a977afa 100644
--- a/tests/test_location.py
+++ b/tests/test_location.py
@@ -106,20 +106,23 @@ class TestTotalConnectLocation(unittest.TestCase):
def tests_set_zone_details(self):
"""Test set_zone_details with normal data passed in."""
- self.location_normal._update_zone_details(RESPONSE_GET_ZONE_DETAILS_SUCCESS)
+ location = TotalConnectLocation(LOCATION_INFO_BASIC_NORMAL, None)
+ location._update_zone_details(RESPONSE_GET_ZONE_DETAILS_SUCCESS)
+ assert len(location.zones) == 1
- # "Zones" is None
+ location = TotalConnectLocation(LOCATION_INFO_BASIC_NORMAL, None)
+ # "Zones" is None, as seen in #112 and #205
response = deepcopy(RESPONSE_GET_ZONE_DETAILS_SUCCESS)
response["ZoneStatus"]["Zones"] = None
- with pytest.raises(PartialResponseError):
- self.location_normal._update_zone_details(response)
+ location._update_zone_details(response)
+ assert len(location.zones) == 0
# "ZoneStatusInfoWithPartitionId" is None
+ location = TotalConnectLocation(LOCATION_INFO_BASIC_NORMAL, None)
response = deepcopy(RESPONSE_GET_ZONE_DETAILS_SUCCESS)
response["ZoneStatus"]["Zones"] = {"ZoneStatusInfoWithPartitionId": None}
- # now test with "ZoneInfo" is none
- with pytest.raises(PartialResponseError):
- self.location_normal._update_zone_details(response)
+ location._update_zone_details(response)
+ assert len(location.zones) == 0
def tests_auto_bypass_low_battery(self):
"""Test auto bypass of low battery zones."""
| PartialResponseError on startup
See https://github.com/home-assistant/core/issues/91703
User can see status in TC app and website, but cannot load data via Home Assistant.
Full log at original ticket above, but basic issue is here:
```txt
File "/usr/local/lib/python3.10/site-packages/total_connect_client/location.py", line 258, in _update_zone_details
raise PartialResponseError("no ZoneStatusInfoWithPartitionId", result)
total_connect_client.exceptions.PartialResponseError: ('no ZoneStatusInfoWithPartitionId', OrderedDict([('ResultCode', 0), ('ResultData', 'Success'), ('ZoneStatus', OrderedDict([('Zones', None)]))]))```
```
Maybe our refactoring of code has led to #112 coming back ?
In `location._update_zones()` if we see Zones=None we highlight that with a log message telling the user how to fix it, and then raise TotalConnectError.
But in `location._update_zone_details()` [which only runs once at startup] we don't provide a log message and raise PartialResponseError.
Waiting for the user to verify that a panel sync fixes this.
| 0.0 | 746ec69379f4fe650e9318bb991673989f5a3ac0 | [
"tests/test_client_misc.py::TestTotalConnectClient::tests_get_zone_details",
"tests/test_location.py::TestTotalConnectLocation::tests_set_zone_details"
]
| [
"tests/test_client_misc.py::TestTotalConnectClient::tests_zone_status",
"tests/test_location.py::TestTotalConnectLocation::tests_auto_bypass_low_battery",
"tests/test_location.py::TestTotalConnectLocation::tests_basic",
"tests/test_location.py::TestTotalConnectLocation::tests_panel",
"tests/test_location.py::TestTotalConnectLocation::tests_set_usercode",
"tests/test_location.py::TestTotalConnectLocation::tests_status",
"tests/test_location.py::TestTotalConnectLocation::tests_update_status_none"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_issue_reference",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2023-04-29 22:05:29+00:00 | mit | 1,724 |
|
crccheck__postdoc-22 | diff --git a/.gitignore b/.gitignore
index eaf7061..2092535 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
.env
*.egg
*.egg-info/
+*.eggs
*.pyc
__pycache__
build/
diff --git a/postdoc.py b/postdoc.py
index 878e0c5..2b87cba 100755
--- a/postdoc.py
+++ b/postdoc.py
@@ -11,50 +11,64 @@ Options:
--postdoc-quiet Don't print debugging output.
"""
+from __future__ import unicode_literals
import os
import subprocess
import sys
try:
# Python 3
from urllib.parse import urlparse
+ from urllib.parse import unquote
except ImportError:
# Python 2
from urlparse import urlparse
+ from urllib import unquote
__version__ = '0.4.0'
-def get_uri(env='DATABASE_URL'):
+def get_uri(env_var='DATABASE_URL'):
"""Grab and parse the url from the environment."""
- # trick python3's urlparse into raising an exception
- return urlparse(os.environ.get(env, 1337))
+ parsed_result = urlparse(
+ # Trick python3's urlparse into raising when env var is missing
+ os.environ.get(env_var, 1337)
+ )
+ meta = {
+ 'scheme': parsed_result.scheme,
+ 'username': unquote(parsed_result.username or ''),
+ 'password': unquote(parsed_result.password or ''),
+ 'hostname': parsed_result.hostname,
+ 'port': parsed_result.port,
+ 'path': unquote(parsed_result.path or '/'),
+ }
+ return meta
def pg_connect_bits(meta):
"""Turn the url into connection bits."""
bits = []
- if meta.username:
- bits.extend(['-U', meta.username])
- if meta.hostname:
- bits.extend(['-h', meta.hostname])
- if meta.port:
- bits.extend(['-p', str(meta.port)])
+ if meta['username']:
+ bits.extend(['-U', meta['username']])
+ if meta['hostname']:
+ bits.extend(['-h', meta['hostname']])
+ if meta['port']:
+ bits.extend(['-p', str(meta['port'])])
return bits
def mysql_connect_bits(meta):
"""Turn the url into connection bits."""
bits = []
- if meta.username:
- bits.extend(['-u', meta.username])
- if meta.password:
- # password is one token
- bits.append('-p{0}'.format(meta.password))
- if meta.hostname:
- bits.extend(['-h', meta.hostname])
- if meta.port:
- bits.extend(['-P', str(meta.port)])
+ if meta['username']:
+ bits.extend(['-u', meta['username']])
+ if meta['password']:
+ # `password` is one token for mysql (no whitespace)
+ bits.append('-p{0}'.format(meta['password']))
+ if meta['hostname']:
+ bits.extend(['-h', meta['hostname']])
+ if meta['port']:
+ bits.extend(['-P', str(meta['port'])])
return bits
@@ -65,7 +79,7 @@ def connect_bits(meta):
'postgresql': pg_connect_bits,
'postgis': pg_connect_bits,
}
- scheme = getattr(meta, 'scheme', 'postgres') # default to postgres
+ scheme = meta.get('scheme', 'postgres') # Default to postgres
# TODO raise a better error than KeyError with an unsupported scheme
return bit_makers[scheme](meta)
@@ -85,32 +99,31 @@ def get_command(command, meta):
bits.append('--dbname')
if command == 'mysql':
bits.append('--database')
- bits.append(meta.path[1:])
- # outtahere
+ bits.append(meta['path'][1:])
return bits
def make_tokens_and_env(sys_argv):
"""Get the tokens or quit with help."""
if sys_argv[1].isupper():
- environ_key = sys_argv[1]
+ env_var = sys_argv[1]
args = sys_argv[2:]
else:
- environ_key = 'DATABASE_URL'
+ env_var = 'DATABASE_URL'
args = sys_argv[1:]
try:
- meta = get_uri(environ_key)
+ meta = get_uri(env_var)
# if we need to switch logic based off scheme multiple places, may want
# to normalize it at this point
tokens = get_command(args[0], meta)
except AttributeError:
exit('Usage: phd COMMAND [additional-options]\n\n'
- ' ERROR: "{0}" is not set in the environment'.format(environ_key))
+ ' ERROR: "{0}" is not set in the environment'.format(env_var))
env = os.environ.copy()
# password as environment variable, set it for non-postgres schemas anyways
- if meta.password:
- env['PGPASSWORD'] = meta.password
+ if meta['password']:
+ env['PGPASSWORD'] = meta['password']
# pass any other flags the user set along
tokens.extend(args[1:])
return tokens, env
| crccheck/postdoc | 73eab13dfd694d8acee8bb1cd1bb5f9fb8a86a74 | diff --git a/test_postdoc.py b/test_postdoc.py
index 02a427a..e34a21b 100644
--- a/test_postdoc.py
+++ b/test_postdoc.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-
+from __future__ import unicode_literals
import os
import unittest
@@ -14,86 +14,92 @@ if 'DATABASE_URL' in os.environ:
exit('Re-run tests in an environment without DATABASE_URL')
-class ConnectBitsTest(unittest.TestCase):
+class ConnectBitsTests(unittest.TestCase):
def test_pg_connect_bits_trivial_case(self):
- meta = type('mock', (object, ),
- {'username': '', 'hostname': '', 'port': ''})
+ meta = {'username': '', 'hostname': '', 'port': ''}
result = postdoc.pg_connect_bits(meta)
self.assertEqual(result, [])
def test_pg_connect_bits_works(self):
- meta = type('mock', (object, ),
- {'scheme': 'postgres', 'username': '1', 'hostname': '2', 'port': 3})
+ meta = {'scheme': 'postgres', 'username': '1', 'hostname': '2', 'port': 3}
result = postdoc.pg_connect_bits(meta)
self.assertEqual(result, ['-U', '1', '-h', '2', '-p', '3'])
result = postdoc.connect_bits(meta)
self.assertEqual(result, ['-U', '1', '-h', '2', '-p', '3'])
def test_mysql_connect_bits_trivial_case(self):
- meta = type('mock', (object, ),
- {'username': '', 'password': '', 'hostname': '', 'port': ''})
+ meta = {'username': '', 'password': '', 'hostname': '', 'port': ''}
result = postdoc.mysql_connect_bits(meta)
self.assertEqual(result, [])
def test_mysql_connect_bits_works(self):
- meta = type('mock', (object, ),
- {'scheme': 'mysql', 'username': 'u', 'password': 'p',
- 'hostname': 'h', 'port': '3306'})
+ meta = {'scheme': 'mysql', 'username': 'u', 'password': 'p',
+ 'hostname': 'h', 'port': '3306'}
result = postdoc.mysql_connect_bits(meta)
self.assertEqual(result, ['-u', 'u', '-pp', '-h', 'h', '-P', '3306'])
result = postdoc.connect_bits(meta)
self.assertEqual(result, ['-u', 'u', '-pp', '-h', 'h', '-P', '3306'])
def test_connect_bits_supported_schemas(self):
- meta = type('mock', (object, ),
- {'username': '', 'password': '', 'hostname': 'h', 'port': ''})
+ meta = {'username': '', 'password': '', 'hostname': 'h', 'port': ''}
# assert defaults to postgres
self.assertTrue(postdoc.connect_bits(meta))
- meta.scheme = 'mysql'
+ meta['scheme'] = 'mysql'
self.assertTrue(postdoc.connect_bits(meta))
- meta.scheme = 'postgres'
+ meta['scheme'] = 'postgres'
self.assertTrue(postdoc.connect_bits(meta))
- meta.scheme = 'postgresql'
+ meta['scheme'] = 'postgresql'
self.assertTrue(postdoc.connect_bits(meta))
- meta.scheme = 'postgis'
+ meta['scheme'] = 'postgis'
self.assertTrue(postdoc.connect_bits(meta))
- meta.scheme = 'foo'
+ meta['scheme'] = 'foo'
self.assertRaises(KeyError, postdoc.connect_bits, meta)
-class PHDTest(unittest.TestCase):
+class PHDTests(unittest.TestCase):
def test_get_uri(self):
with mock.patch('postdoc.os') as mock_os:
mock_os.environ = {
'DATABASE_URL': 'foo',
'FATTYBASE_URL': 'bar',
}
- self.assertEqual(postdoc.get_uri().path, 'foo')
- self.assertEqual(postdoc.get_uri('FATTYBASE_URL').path, 'bar')
+ self.assertEqual(postdoc.get_uri()['path'], 'foo')
+ self.assertEqual(postdoc.get_uri('FATTYBASE_URL')['path'], 'bar')
+
+ def test_get_uri_decodes_urlencoded(self):
+ with mock.patch('postdoc.os') as mock_os:
+ mock_os.environ = {
+ 'DATABASE_URL': 'mysql://user%3F:%21mysecure%3Apassword%[email protected]:3307/foo',
+ }
+ self.assertEqual(postdoc.get_uri(), {
+ 'scheme': 'mysql',
+ 'username': 'user?',
+ 'password': '!mysecure:password#',
+ 'hostname': '127.0.0.1',
+ 'port': 3307,
+ 'path': '/foo',
+ })
def test_get_command_assembles_bits_in_right_order(self):
- meta = type('mock', (object, ),
- {'username': '', 'hostname': '', 'port': '', 'password': '',
- 'path': '/database'})
+ meta = {'username': '', 'hostname': '', 'port': '', 'password': '',
+ 'path': '/database'}
with mock.patch('postdoc.pg_connect_bits') as mock_bits:
mock_bits.return_value = ['lol']
self.assertEqual(postdoc.get_command('foo', meta),
['foo', 'lol', 'database'])
def test_get_command_ignores_password(self):
- meta = type('mock', (object, ),
- {'username': '', 'hostname': '', 'port': '', 'password': 'oops',
- 'path': '/database'})
+ meta = {'username': '', 'hostname': '', 'port': '', 'password': 'oops',
+ 'path': '/database'}
with mock.patch('postdoc.pg_connect_bits') as mock_bits:
mock_bits.return_value = ['rofl']
self.assertEqual(postdoc.get_command('bar', meta),
['bar', 'rofl', 'database'])
def test_get_commands_can_ignore_database_name(self):
- meta = type('mock', (object, ),
- {'scheme': 'mysql', 'username': 'u', 'hostname': 'h', 'port': '',
- 'password': 'oops', 'path': '/database'})
+ meta = {'scheme': 'mysql', 'username': 'u', 'hostname': 'h', 'port': '',
+ 'password': 'oops', 'path': '/database'}
result = postdoc.get_command('mysqladmin', meta)
# assert database name is not an argument
self.assertNotIn('database', result)
@@ -102,23 +108,48 @@ class PHDTest(unittest.TestCase):
['mysqladmin', '-u', 'u', '-poops', '-h', 'h'])
def test_get_command_special_syntax_for_pg_restore(self):
- meta = type('mock', (object, ),
- {'username': '', 'hostname': '', 'port': '', 'password': 'oops',
- 'path': '/database'})
+ meta = {'username': '', 'hostname': '', 'port': '', 'password': 'oops',
+ 'path': '/database'}
with mock.patch('postdoc.pg_connect_bits') as mock_bits:
mock_bits.return_value = ['rofl']
self.assertEqual(postdoc.get_command('pg_restore', meta),
['pg_restore', 'rofl', '--dbname', 'database'])
def test_get_command_special_syntax_for_mysql(self):
- meta = type('mock', (object, ),
- {'scheme': 'mysql', 'username': '', 'hostname': '', 'port': '',
- 'password': 'oops', 'path': '/database'})
+ meta = {'scheme': 'mysql', 'username': '', 'hostname': '', 'port': '',
+ 'password': 'oops', 'path': '/database'}
with mock.patch('postdoc.connect_bits') as mock_bits:
mock_bits.return_value = ['rofl']
self.assertEqual(postdoc.get_command('mysql', meta),
['mysql', 'rofl', '--database', 'database'])
+ def test_make_tokens_and_env_happy_case(self):
+ mock_os = mock.MagicMock(environ={
+ 'DATABASE_URL': 'mysql://u:p@h:3306/test',
+ })
+
+ with mock.patch.multiple(postdoc, os=mock_os):
+ tokens, env = postdoc.make_tokens_and_env(
+ ['argv1', 'mysql', 'extra_arg'])
+ self.assertEqual(
+ tokens,
+ ['mysql', '-u', 'u', '-pp', '-h', 'h', '-P', '3306', '--database', 'test', 'extra_arg']
+ )
+
+ @unittest.skip('TODO')
+ def test_make_tokens_and_env_handles_urlencoded_password(self):
+ mock_os = mock.MagicMock(environ={
+ 'DATABASE_URL': 'mysql://u:%21mysecure%3Apassword%23@h/test',
+ })
+
+ with mock.patch.multiple(postdoc, os=mock_os):
+ tokens, env = postdoc.make_tokens_and_env(
+ ['argv1', 'mysql', 'extra_arg'])
+ self.assertEqual(
+ tokens,
+ ['mysql', '-u', 'u', '-p!mysecure:password#', '-h', 'h', '--database', 'test', 'extra_arg']
+ )
+
def test_make_tokens_and_env_exits_with_bad_command(self):
with self.assertRaises(SystemExit):
postdoc.make_tokens_and_env(['phd', 'fun'])
@@ -213,8 +244,7 @@ class PHDTest(unittest.TestCase):
def test_main_passes_password_in_env(self):
my_password = 'hunter2'
- meta = type('mock', (object, ),
- {'password': my_password})
+ meta = {'password': my_password}
mock_subprocess = mock.MagicMock()
mock_get_command = mock.MagicMock(return_value=['get_command'])
mock_get_uri = mock.MagicMock(return_value=meta)
| urldecode passwords
for example, if a password contained ':', you'd have to encode it `%..` to get it to parse right (otherwise it'd think it's a port). | 0.0 | 73eab13dfd694d8acee8bb1cd1bb5f9fb8a86a74 | [
"test_postdoc.py::PHDTests::test_get_command_assembles_bits_in_right_order",
"test_postdoc.py::PHDTests::test_get_uri_decodes_urlencoded",
"test_postdoc.py::PHDTests::test_get_command_special_syntax_for_mysql",
"test_postdoc.py::PHDTests::test_main_passes_password_in_env",
"test_postdoc.py::PHDTests::test_get_commands_can_ignore_database_name",
"test_postdoc.py::PHDTests::test_get_uri",
"test_postdoc.py::PHDTests::test_get_command_special_syntax_for_pg_restore",
"test_postdoc.py::PHDTests::test_get_command_ignores_password",
"test_postdoc.py::ConnectBitsTests::test_mysql_connect_bits_trivial_case",
"test_postdoc.py::ConnectBitsTests::test_pg_connect_bits_trivial_case",
"test_postdoc.py::ConnectBitsTests::test_connect_bits_supported_schemas",
"test_postdoc.py::ConnectBitsTests::test_mysql_connect_bits_works",
"test_postdoc.py::ConnectBitsTests::test_pg_connect_bits_works"
]
| [
"test_postdoc.py::PHDTests::test_nonsense_command_has_meaningful_error",
"test_postdoc.py::PHDTests::test_main_appends_additional_flags",
"test_postdoc.py::PHDTests::test_make_tokens_and_env_exits_with_bad_command",
"test_postdoc.py::PHDTests::test_main_command_debug_can_be_quiet",
"test_postdoc.py::PHDTests::test_main_works",
"test_postdoc.py::PHDTests::test_make_tokens_and_env_can_use_alternate_url",
"test_postdoc.py::PHDTests::test_make_tokens_and_env_exits_with_missing_env",
"test_postdoc.py::PHDTests::test_main_can_do_a_dry_run_to_stdout",
"test_postdoc.py::PHDTests::test_main_exits_with_no_command",
"test_postdoc.py::PHDTests::test_make_tokens_and_env_happy_case"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2018-03-24 15:37:49+00:00 | apache-2.0 | 1,725 |
|
crccheck__project_runpy-17 | diff --git a/Makefile b/Makefile
index 025331e..508e289 100644
--- a/Makefile
+++ b/Makefile
@@ -25,8 +25,8 @@ test: ## Run test suite
# Bump project_runpy.__version__
# Update CHANGELOG (TODO)
# `git commit -am "1.0.0"`
-# `git tag v1.0.0`
# `make publish`
+# `git tag v1.0.0`
# `git push --tags origin master`
publish: ## Publish a release to PyPI
flit publish
diff --git a/project_runpy/heidi.py b/project_runpy/heidi.py
index 09e34f2..030b8c5 100644
--- a/project_runpy/heidi.py
+++ b/project_runpy/heidi.py
@@ -113,7 +113,7 @@ class ReadableSqlFilter(logging.Filter):
def filter(self, record):
# https://github.com/django/django/blob/febe136d4c3310ec8901abecca3ea5ba2be3952c/django/db/backends/utils.py#L106-L131
duration, sql, *__ = record.args
- if 'SELECT' not in sql[:28]:
+ if not sql or 'SELECT' not in sql[:28]:
# WISHLIST what's the most performant way to see if 'SELECT' was
# used?
return super().filter(record)
| crccheck/project_runpy | b70c8b4dc398411a02905ad7c97db388ace9e4fd | diff --git a/test_project_runpy.py b/test_project_runpy.py
index 3f489e9..c24f978 100644
--- a/test_project_runpy.py
+++ b/test_project_runpy.py
@@ -144,6 +144,11 @@ class HeidiReadableSqlFilter(TestCase):
self.assertTrue(logging_filter.filter(record))
self.assertEqual('foo', record.args[1])
+ def test_filter_runs_when_no_sql_exists(self):
+ logging_filter = ReadableSqlFilter()
+ record = mock.MagicMock(args=(0.07724404335021973, None, ()))
+ self.assertTrue(logging_filter.filter(record))
+
def test_filter_params_is_optional(self):
logging_filter = ReadableSqlFilter()
record = mock.MagicMock(args=())
| SQL filter: TypeError: 'NoneType' object is not subscriptable
if 'SELECT' not in sql[:28]:
TypeError: 'NoneType' object is not subscriptable | 0.0 | b70c8b4dc398411a02905ad7c97db388ace9e4fd | [
"test_project_runpy.py::HeidiReadableSqlFilter::test_filter_runs_when_no_sql_exists"
]
| [
"test_project_runpy.py::TestTimEnv::test_can_coerce_to_other_types",
"test_project_runpy.py::TestTimEnv::test_coerced_bool_no_default_no_value_is_true",
"test_project_runpy.py::TestTimEnv::test_f_gives_false",
"test_project_runpy.py::TestTimEnv::test_false_gives_false",
"test_project_runpy.py::TestTimEnv::test_get_bool_coerced_version_false",
"test_project_runpy.py::TestTimEnv::test_get_bool_coerced_version_true",
"test_project_runpy.py::TestTimEnv::test_geting_empty_is_null_string",
"test_project_runpy.py::TestTimEnv::test_gets_as_bool_if_default_is_bool",
"test_project_runpy.py::TestTimEnv::test_gets_value",
"test_project_runpy.py::TestTimEnv::test_no_default_unless_in_environment",
"test_project_runpy.py::TestTimEnv::test_no_default_unless_in_environment_and_bool",
"test_project_runpy.py::TestTimEnv::test_reads_from_default",
"test_project_runpy.py::TestTimEnv::test_reads_from_environment_if_set",
"test_project_runpy.py::TestTimEnv::test_require_acts_like_get",
"test_project_runpy.py::TestTimEnv::test_require_raises_exception",
"test_project_runpy.py::TestTimEnv::test_require_raises_exception_with_stupid_default",
"test_project_runpy.py::TestTimEnv::test_zero_gives_false",
"test_project_runpy.py::HeidiColorizingStreamHandler::test_it_can_be_added_to_logger",
"test_project_runpy.py::HeidiReadableSqlFilter::test_filter_formats_ignores_select_without_from",
"test_project_runpy.py::HeidiReadableSqlFilter::test_filter_formats_select_from",
"test_project_runpy.py::HeidiReadableSqlFilter::test_filter_formats_select_from_long",
"test_project_runpy.py::HeidiReadableSqlFilter::test_filter_params_is_optional",
"test_project_runpy.py::HeidiReadableSqlFilter::test_filter_trivial_case",
"test_project_runpy.py::HeidiReadableSqlFilter::test_it_can_be_added_to_logger"
]
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2019-11-14 00:17:47+00:00 | apache-2.0 | 1,726 |
|
creisle__markdown_refdocs-19 | diff --git a/markdown_refdocs/parsers.py b/markdown_refdocs/parsers.py
index 586a383..d4d46e4 100644
--- a/markdown_refdocs/parsers.py
+++ b/markdown_refdocs/parsers.py
@@ -19,6 +19,11 @@ def parse_google_docstring(
) -> ParsedDocstring:
"""
parses a google-style docsting into a dictionary of the various sections
+
+ Args:
+ docstring: the docstring to parse
+ hide_undoc: if True, undocumented arguments will be marked as hidden
+ function_name: name of the function the docstring is for (only used in debugging)
"""
state = None
tags = [
@@ -31,6 +36,7 @@ def parse_google_docstring(
'examples',
'attributes',
'warning',
+ 'todo',
]
content: Dict[str, Any] = {tag: [] for tag in tags}
diff --git a/markdown_refdocs/types.py b/markdown_refdocs/types.py
index cb70fe0..e177b0c 100644
--- a/markdown_refdocs/types.py
+++ b/markdown_refdocs/types.py
@@ -44,6 +44,7 @@ class ParsedDocstring(TypedDict):
returns: ParsedReturn
parameters: List[ParsedParameter]
attributes: List[ParsedParameter]
+ todo: List[str]
class ParsedVariable(Parsed):
@@ -65,4 +66,15 @@ class ParsedModule(Parsed):
variables: List[ParsedVariable]
-ADMONITIONS = ['warning', 'note', 'info', 'bug', 'tip', 'question', 'failure', 'danger', 'quote']
+ADMONITIONS = [
+ 'warning',
+ 'note',
+ 'info',
+ 'bug',
+ 'tip',
+ 'question',
+ 'failure',
+ 'danger',
+ 'quote',
+ 'todo',
+]
| creisle/markdown_refdocs | 0284e8471c2be4e9083be00ad94f6e495fb2e801 | diff --git a/tests/test_markdown.py b/tests/test_markdown.py
index 0c059b7..f7e9522 100644
--- a/tests/test_markdown.py
+++ b/tests/test_markdown.py
@@ -1,4 +1,9 @@
-from markdown_refdocs.markdown import constant_to_markdown, create_type_link, function_to_markdown
+from markdown_refdocs.markdown import (
+ constant_to_markdown,
+ create_type_link,
+ function_to_markdown,
+ admonitions_to_markdown,
+)
class TestConstantToMarkdown:
@@ -87,3 +92,24 @@ class TestCreateTypeLink:
types = {'type': link}
md = create_type_link('Tuple[type, type]', types)
assert md == f'Tuple\\[[type]({link}), [type]({link})\\]'
+
+
+class TestAdmonitions:
+ def test_todo(self):
+ parsed = {
+ 'todo': [
+ '* validate pk_col exists on table',
+ '* validate group_by is a column/list of columns on table',
+ '* validate filter_col exists on table',
+ '* validate dist_table joins to table?',
+ ]
+ }
+
+ expected = """!!! todo
+\t* validate pk_col exists on table
+\t* validate group_by is a column/list of columns on table
+\t* validate filter_col exists on table
+\t* validate dist_table joins to table?
+"""
+ actual = admonitions_to_markdown(parsed)
+ assert actual == expected
diff --git a/tests/test_parsers.py b/tests/test_parsers.py
index 63f16f2..86d0823 100644
--- a/tests/test_parsers.py
+++ b/tests/test_parsers.py
@@ -62,3 +62,24 @@ If the input string is only numbers, return a tuple of (None, {numbers}).
Otherwise return a tuple of Nones."""
assert result['description'] == expected
assert len(result['examples']) == 4
+
+ def test_todo(self):
+ docstring = """
+validator for pk_select endpoint
+Todo:
+ * validate pk_col exists on table
+ * validate group_by is a column/list of columns on table
+ * validate filter_col exists on table
+ * validate dist_table joins to table?
+"""
+ result = parse_google_docstring(docstring)
+
+ expected = [
+ '* validate pk_col exists on table',
+ '* validate group_by is a column/list of columns on table',
+ '* validate filter_col exists on table',
+ '* validate dist_table joins to table?',
+ ]
+
+ for index, line in enumerate(result['todo']):
+ assert line == expected[index]
| add admonitions for `Todo`s
it would be nice if Todo sections in docstrings where put into an [admonition](https://squidfunk.github.io/mkdocs-material/reference/admonitions/) of some kind rather than ending up in the main description
for example, the following docstring:
```
"""
validator for pk_select endpoint
Todo:
* validate pk_col exists on table
* validate group_by is a column/list of columns on table
* validate filter_col exists on table
* validate dist_table joins to table?
"""
```
end up like so:

| 0.0 | 0284e8471c2be4e9083be00ad94f6e495fb2e801 | [
"tests/test_markdown.py::TestAdmonitions::test_todo",
"tests/test_parsers.py::TestParseGoogleDocstring::test_todo"
]
| [
"tests/test_markdown.py::TestConstantToMarkdown::test_no_source_code",
"tests/test_markdown.py::TestConstantToMarkdown::test_has_source_code",
"tests/test_markdown.py::TestFunctionToMarkdown::test_has_docstring_no_params",
"tests/test_markdown.py::TestFunctionToMarkdown::test_long_docstring",
"tests/test_markdown.py::TestCreateTypeLink::test_simple_link",
"tests/test_markdown.py::TestCreateTypeLink::test_link_inside_list",
"tests/test_markdown.py::TestCreateTypeLink::test_linking_as_dict_target",
"tests/test_markdown.py::TestCreateTypeLink::test_tuple_of_links",
"tests/test_parsers.py::TestParseGoogleDocstring::test_nested_types",
"tests/test_parsers.py::TestParseGoogleDocstring::test_add_extra_returns_to_description",
"tests/test_parsers.py::TestParseGoogleDocstring::test_long_docstring_with_newlines"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2020-08-23 19:03:15+00:00 | mit | 1,727 |
|
csdms__bmi-topography-36 | diff --git a/bmi_topography/cli.py b/bmi_topography/cli.py
index 20c2121..4bbf24a 100644
--- a/bmi_topography/cli.py
+++ b/bmi_topography/cli.py
@@ -8,7 +8,7 @@ from .topography import Topography
@click.version_option()
@click.option("-q", "--quiet", is_flag=True, help="Enables quiet mode.")
@click.option(
- "--dem_type",
+ "--dem-type",
type=click.Choice(Topography.VALID_DEM_TYPES, case_sensitive=True),
default=Topography.DEFAULT["dem_type"],
help="The global raster dataset.",
@@ -43,19 +43,19 @@ from .topography import Topography
show_default=True,
)
@click.option(
- "--output_format",
+ "--output-format",
type=click.Choice(Topography.VALID_OUTPUT_FORMATS.keys(), case_sensitive=True),
default=Topography.DEFAULT["output_format"],
help="Output file format.",
show_default=True,
)
@click.option(
- "--api_key",
+ "--api-key",
type=str,
help="OpenTopography API key.",
show_default=True,
)
[email protected]("--no_fetch", is_flag=True, help="Do not fetch data from server.")
[email protected]("--no-fetch", is_flag=True, help="Do not fetch data from server.")
def main(quiet, dem_type, south, north, west, east, output_format, api_key, no_fetch):
"""Fetch and cache NASA SRTM and JAXA ALOS land elevation data
@@ -73,9 +73,12 @@ def main(quiet, dem_type, south, north, west, east, output_format, api_key, no_f
topo = Topography(dem_type, south, north, west, east, output_format)
if not no_fetch:
if not quiet:
- click.secho("Fetching data...", fg="yellow")
- topo.fetch()
+ click.secho("Fetching data...", fg="yellow", err=True)
+ path_to_dem = topo.fetch()
if not quiet:
click.secho(
- "File downloaded to {}".format(getattr(topo, "cache_dir")), fg="green"
+ "File downloaded to {}".format(getattr(topo, "cache_dir")),
+ fg="green",
+ err=True,
)
+ print(path_to_dem)
diff --git a/bmi_topography/topography.py b/bmi_topography/topography.py
index 6198662..91070dd 100644
--- a/bmi_topography/topography.py
+++ b/bmi_topography/topography.py
@@ -1,6 +1,7 @@
"""Base class to access elevation data"""
import os
import urllib
+import warnings
from pathlib import Path
import requests
@@ -9,7 +10,7 @@ import xarray as xr
from .bbox import BoundingBox
-def find_api_key():
+def find_user_api_key():
"""Search for an API key."""
if "OPENTOPOGRAPHY_API_KEY" in os.environ:
api_key = os.environ["OPENTOPOGRAPHY_API_KEY"]
@@ -21,6 +22,15 @@ def find_api_key():
return api_key
+def use_demo_key():
+ warnings.warn(
+ "You are using a demo key to fetch data from OpenTopography, functionality "
+ "will be limited. See https://bmi-topography.readthedocs.io/en/latest/#api-key "
+ "for more information."
+ )
+ return "demoapikeyot2022"
+
+
def read_first_of(files):
"""Read the contents of the first file encountered."""
contents = ""
@@ -67,7 +77,7 @@ class Topography:
api_key=None,
):
if api_key is None:
- self._api_key = find_api_key()
+ self._api_key = find_user_api_key() or use_demo_key()
else:
self._api_key = api_key
diff --git a/examples/.opentopography.txt b/examples/.opentopography.txt
deleted file mode 100644
index e367779..0000000
--- a/examples/.opentopography.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-demoapikeyot2022
diff --git a/examples/bmi-topography_ex.sh b/examples/bmi-topography_ex.sh
index 4234a7c..389ca57 100644
--- a/examples/bmi-topography_ex.sh
+++ b/examples/bmi-topography_ex.sh
@@ -12,9 +12,9 @@ bmi-topography --version
bmi-topography --help
bmi-topography \
- --dem_type=$DEM_TYPE \
+ --dem-type=$DEM_TYPE \
--south=$SOUTH \
--north=$NORTH \
--west=$WEST \
--east=$EAST \
- --output_format=$OUTPUT_FORMAT
+ --output-format=$OUTPUT_FORMAT
| csdms/bmi-topography | 6d47074340e29d2613b21c88ff42743f6472709e | diff --git a/tests/test_api_key.py b/tests/test_api_key.py
index 1751b37..9107a76 100644
--- a/tests/test_api_key.py
+++ b/tests/test_api_key.py
@@ -1,7 +1,9 @@
import os
from unittest import mock
-from bmi_topography.topography import find_api_key, read_first_of
+import pytest
+
+from bmi_topography.topography import find_user_api_key, read_first_of, use_demo_key
def copy_environ(exclude=None):
@@ -13,24 +15,24 @@ def copy_environ(exclude=None):
return {key: value for key, value in os.environ.items() if key not in exclude}
-def test_find_api_key_not_found():
+def test_find_user_api_key_not_found():
"""The API key is not given anywhere"""
env = copy_environ(exclude="OPENTOPOGRAPHY_API_KEY")
with mock.patch.dict(os.environ, env, clear=True):
- assert find_api_key() == ""
+ assert find_user_api_key() == ""
@mock.patch.dict(os.environ, {"OPENTOPOGRAPHY_API_KEY": "foo"})
-def test_find_api_key_env(tmpdir):
+def test_find_user_api_key_env(tmpdir):
"""The API key is an environment variable"""
with tmpdir.as_cwd():
with open(".opentopography.txt", "w") as fp:
fp.write("bar")
- assert find_api_key() == "foo"
+ assert find_user_api_key() == "foo"
@mock.patch.dict(os.environ, {"OPENTOPOGRAPHY_API_KEY": "foo"})
-def test_find_api_key_from_file(tmpdir):
+def test_find_user_api_key_from_file(tmpdir):
"""The API key is in a file"""
env = copy_environ(exclude="OPENTOPOGRAPHY_API_KEY")
with tmpdir.as_cwd():
@@ -38,7 +40,7 @@ def test_find_api_key_from_file(tmpdir):
fp.write("bar")
with mock.patch.dict(os.environ, env, clear=True):
- assert find_api_key() == "bar"
+ assert find_user_api_key() == "bar"
def test_read_first_missing(tmpdir):
@@ -56,3 +58,14 @@ def test_read_first_file(tmpdir):
assert read_first_of(["foo.txt", "bar.txt"]) == "foo"
assert read_first_of(["bar.txt", "foo.txt"]) == "bar"
+
+
+def test_use_demo_key_is_a_string():
+ demo_key = use_demo_key()
+ assert isinstance(demo_key, str)
+ assert len(demo_key) > 0
+
+
+def test_use_demo_key_issues_warning():
+ with pytest.warns(UserWarning):
+ use_demo_key()
diff --git a/tests/test_cli.py b/tests/test_cli.py
index cd5ec63..696cd67 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1,4 +1,6 @@
"""Test bmi-topography command-line interface"""
+import pathlib
+
from click.testing import CliRunner
from bmi_topography.cli import main
@@ -20,31 +22,40 @@ def test_version():
def test_defaults():
runner = CliRunner()
- result = runner.invoke(main)
+ result = runner.invoke(main, ["--quiet"])
+ assert pathlib.Path(result.output.strip()).is_file()
assert result.exit_code == 0
+def test_quiet():
+ runner = CliRunner()
+ quiet_lines = runner.invoke(main, ["--quiet"]).output.splitlines()
+ verbose_lines = runner.invoke(main).output.splitlines()
+
+ assert len(verbose_lines) > len(quiet_lines)
+
+
def test_demtype_valid():
runner = CliRunner()
- result = runner.invoke(main, ["--dem_type=SRTMGL1", "--no_fetch"])
+ result = runner.invoke(main, ["--dem-type=SRTMGL1", "--no-fetch"])
assert result.exit_code == 0
def test_demtype_invalid():
runner = CliRunner()
- result = runner.invoke(main, ["--dem_type=foobar"])
+ result = runner.invoke(main, ["--dem-type=foobar"])
assert result.exit_code != 0
def test_demtype_is_case_sensitive():
runner = CliRunner()
- result = runner.invoke(main, ["--dem_type=srtmgl1"])
+ result = runner.invoke(main, ["--dem-type=srtmgl1"])
assert result.exit_code != 0
def test_south_inrange():
runner = CliRunner()
- result = runner.invoke(main, ["--south=-90.0", "--no_fetch"])
+ result = runner.invoke(main, ["--south=-90.0", "--no-fetch"])
assert result.exit_code == 0
@@ -56,7 +67,7 @@ def test_south_outrange():
def test_north_inrange():
runner = CliRunner()
- result = runner.invoke(main, ["--north=90.0", "--no_fetch"])
+ result = runner.invoke(main, ["--north=90.0", "--no-fetch"])
assert result.exit_code == 0
@@ -68,7 +79,7 @@ def test_north_outrange():
def test_west_inrange():
runner = CliRunner()
- result = runner.invoke(main, ["--west=-180.0", "--no_fetch"])
+ result = runner.invoke(main, ["--west=-180.0", "--no-fetch"])
assert result.exit_code == 0
@@ -80,7 +91,7 @@ def test_west_outrange():
def test_east_inrange():
runner = CliRunner()
- result = runner.invoke(main, ["--east=180.0", "--no_fetch"])
+ result = runner.invoke(main, ["--east=180.0", "--no-fetch"])
assert result.exit_code == 0
@@ -92,17 +103,17 @@ def test_east_outrange():
def test_output_format_valid():
runner = CliRunner()
- result = runner.invoke(main, ["--output_format=GTiff", "--no_fetch"])
+ result = runner.invoke(main, ["--output-format=GTiff", "--no-fetch"])
assert result.exit_code == 0
def test_output_format_invalid():
runner = CliRunner()
- result = runner.invoke(main, ["--output_format=foobar"])
+ result = runner.invoke(main, ["--output-format=foobar"])
assert result.exit_code != 0
def test_output_format_is_case_sensitive():
runner = CliRunner()
- result = runner.invoke(main, ["--output_format=gtiff"])
+ result = runner.invoke(main, ["--output-format=gtiff"])
assert result.exit_code != 0
| Underscores in bmi-topography command line options
I'm wondering about the `_`s in the *bmi-topography* command line options (e.g. `--no_fetch`, `--api_key`). It seems more standard to use `-`s in such cases (e.g. `--no-fetch`, `--api-key`). | 0.0 | 6d47074340e29d2613b21c88ff42743f6472709e | [
"tests/test_api_key.py::test_find_user_api_key_not_found",
"tests/test_api_key.py::test_find_user_api_key_env",
"tests/test_api_key.py::test_find_user_api_key_from_file",
"tests/test_api_key.py::test_read_first_missing",
"tests/test_api_key.py::test_read_first_file",
"tests/test_api_key.py::test_use_demo_key_is_a_string",
"tests/test_api_key.py::test_use_demo_key_issues_warning",
"tests/test_cli.py::test_help",
"tests/test_cli.py::test_version",
"tests/test_cli.py::test_defaults",
"tests/test_cli.py::test_quiet",
"tests/test_cli.py::test_demtype_valid",
"tests/test_cli.py::test_demtype_invalid",
"tests/test_cli.py::test_demtype_is_case_sensitive",
"tests/test_cli.py::test_south_inrange",
"tests/test_cli.py::test_south_outrange",
"tests/test_cli.py::test_north_inrange",
"tests/test_cli.py::test_north_outrange",
"tests/test_cli.py::test_west_inrange",
"tests/test_cli.py::test_west_outrange",
"tests/test_cli.py::test_east_inrange",
"tests/test_cli.py::test_east_outrange",
"tests/test_cli.py::test_output_format_valid",
"tests/test_cli.py::test_output_format_invalid",
"tests/test_cli.py::test_output_format_is_case_sensitive"
]
| []
| {
"failed_lite_validators": [
"has_short_problem_statement",
"has_removed_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false
} | 2022-02-16 20:38:13+00:00 | mit | 1,728 |
|
csiro-coasts__emsarray-126 | diff --git a/docs/releases/development.rst b/docs/releases/development.rst
index 416ffd0..7175a6f 100644
--- a/docs/releases/development.rst
+++ b/docs/releases/development.rst
@@ -11,3 +11,6 @@ Next release (in development)
* Drop dependency on importlib_metadata.
This was only required to support Python 3.8, which was dropped in a previous release
(:issue:`122`, :pr:`125`).
+* Fix an error with `ShocSimple.get_all_depth_names()`
+ when the dataset had no depth coordinates
+ (:issue:`123`, :pr:`126`).
diff --git a/src/emsarray/conventions/shoc.py b/src/emsarray/conventions/shoc.py
index 8ef5640..69c9e15 100644
--- a/src/emsarray/conventions/shoc.py
+++ b/src/emsarray/conventions/shoc.py
@@ -57,7 +57,9 @@ class ShocStandard(ArakawaC):
return name
def get_all_depth_names(self) -> List[Hashable]:
- return ['z_centre', 'z_grid']
+ return [
+ name for name in ['z_centre', 'z_grid']
+ if name in self.dataset.variables]
def get_time_name(self) -> Hashable:
name = 't'
@@ -123,4 +125,8 @@ class ShocSimple(CFGrid2D):
return name
def get_all_depth_names(self) -> List[Hashable]:
- return [self.get_depth_name()]
+ name = 'zc'
+ if name in self.dataset.variables:
+ return [name]
+ else:
+ return []
| csiro-coasts/emsarray | 87b87129054e82509e4666b8b582abc5358c079f | diff --git a/tests/conventions/test_cfgrid2d.py b/tests/conventions/test_cfgrid2d.py
index b73c99b..5c81c38 100644
--- a/tests/conventions/test_cfgrid2d.py
+++ b/tests/conventions/test_cfgrid2d.py
@@ -24,6 +24,7 @@ from shapely.testing import assert_geometries_equal
from emsarray.conventions import get_dataset_convention
from emsarray.conventions.grid import CFGrid2DTopology, CFGridKind
from emsarray.conventions.shoc import ShocSimple
+from emsarray.exceptions import NoSuchCoordinateError
from emsarray.operations import geometry
from tests.utils import (
DiagonalShocGrid, ShocGridGenerator, ShocLayerGenerator,
@@ -175,6 +176,16 @@ def test_varnames():
assert dataset.ems.get_time_name() == 'time'
+def test_no_depth_coordinate():
+ dataset = make_dataset(j_size=10, i_size=10)
+ dataset = dataset.isel({'k': -1}, drop=True)
+ print(dataset)
+
+ assert dataset.ems.get_all_depth_names() == []
+ with pytest.raises(NoSuchCoordinateError):
+ dataset.ems.get_depth_name()
+
+
@pytest.mark.parametrize(
['name', 'attrs'],
[
diff --git a/tests/conventions/test_shoc_standard.py b/tests/conventions/test_shoc_standard.py
index e66dbee..ac63da7 100644
--- a/tests/conventions/test_shoc_standard.py
+++ b/tests/conventions/test_shoc_standard.py
@@ -32,7 +32,7 @@ def make_dataset(
corner_size: int = 0,
) -> xarray.Dataset:
"""
- Make a dummy SHOC simple dataset of a particular size.
+ Make a dummy SHOC standard dataset of a particular size.
It will have a sheared grid of points located near (0, 0),
with increasing j moving north east, and increasing i moving south east.
@@ -187,7 +187,7 @@ def make_dataset(
def test_make_dataset():
dataset = make_dataset(j_size=5, i_size=9, corner_size=2)
- # Check that this is recognised as a ShocSimple dataset
+ # Check that this is recognised as a ShocStandard dataset
assert get_dataset_convention(dataset) is ShocStandard
# Check that the correct convention is used
| Shoc datasets without depth coordinate throw errors
SHOC datasets that do not have a depth coordinate throw an error in `Convention.get_depth_name()` which is correct, but this error bubbles up to `Convention.get_all_depth_names()` which is incorrect. This means that Shoc datasets that have been passed through `Convention.ocean_floor()` will not support `Convention.select_variables()`, for a specific failure case.
`/ShocStandard/ShocSimple.get_all_depth_names()` should not throw an error if there is no depth coordinate. | 0.0 | 87b87129054e82509e4666b8b582abc5358c079f | [
"tests/conventions/test_cfgrid2d.py::test_no_depth_coordinate"
]
| [
"tests/conventions/test_cfgrid2d.py::test_make_dataset",
"tests/conventions/test_cfgrid2d.py::test_varnames",
"tests/conventions/test_cfgrid2d.py::test_latitude_detection[lat-attrs0]",
"tests/conventions/test_cfgrid2d.py::test_latitude_detection[l1-attrs1]",
"tests/conventions/test_cfgrid2d.py::test_latitude_detection[latitude-attrs2]",
"tests/conventions/test_cfgrid2d.py::test_latitude_detection[y-attrs3]",
"tests/conventions/test_cfgrid2d.py::test_latitude_detection[Latitude-attrs4]",
"tests/conventions/test_cfgrid2d.py::test_latitude_detection[lats-attrs5]",
"tests/conventions/test_cfgrid2d.py::test_latitude_detection[latitude-attrs6]",
"tests/conventions/test_cfgrid2d.py::test_latitude_detection[y-attrs7]",
"tests/conventions/test_cfgrid2d.py::test_longitude_detection[lon-attrs0]",
"tests/conventions/test_cfgrid2d.py::test_longitude_detection[l2-attrs1]",
"tests/conventions/test_cfgrid2d.py::test_longitude_detection[longitude-attrs2]",
"tests/conventions/test_cfgrid2d.py::test_longitude_detection[x-attrs3]",
"tests/conventions/test_cfgrid2d.py::test_longitude_detection[Longitude-attrs4]",
"tests/conventions/test_cfgrid2d.py::test_longitude_detection[lons-attrs5]",
"tests/conventions/test_cfgrid2d.py::test_longitude_detection[longitude-attrs6]",
"tests/conventions/test_cfgrid2d.py::test_longitude_detection[x-attrs7]",
"tests/conventions/test_cfgrid2d.py::test_manual_coordinate_names",
"tests/conventions/test_cfgrid2d.py::test_polygons_no_bounds",
"tests/conventions/test_cfgrid2d.py::test_polygons_with_bounds",
"tests/conventions/test_cfgrid2d.py::test_holes",
"tests/conventions/test_cfgrid2d.py::test_bounds",
"tests/conventions/test_cfgrid2d.py::test_face_centres",
"tests/conventions/test_cfgrid2d.py::test_selector_for_index",
"tests/conventions/test_cfgrid2d.py::test_make_geojson_geometry",
"tests/conventions/test_cfgrid2d.py::test_ravel_index",
"tests/conventions/test_cfgrid2d.py::test_grid_kinds",
"tests/conventions/test_cfgrid2d.py::test_grid_kind_and_size",
"tests/conventions/test_cfgrid2d.py::test_ravel",
"tests/conventions/test_cfgrid2d.py::test_wind",
"tests/conventions/test_cfgrid2d.py::test_drop_geometry",
"tests/conventions/test_cfgrid2d.py::test_values",
"tests/conventions/test_cfgrid2d.py::test_plot_on_figure",
"tests/conventions/test_shoc_standard.py::test_make_dataset",
"tests/conventions/test_shoc_standard.py::test_varnames",
"tests/conventions/test_shoc_standard.py::test_polygons",
"tests/conventions/test_shoc_standard.py::test_face_centres",
"tests/conventions/test_shoc_standard.py::test_make_geojson_geometry",
"tests/conventions/test_shoc_standard.py::test_ravel",
"tests/conventions/test_shoc_standard.py::test_ravel_left",
"tests/conventions/test_shoc_standard.py::test_ravel_back",
"tests/conventions/test_shoc_standard.py::test_ravel_grid",
"tests/conventions/test_shoc_standard.py::test_grid_kinds",
"tests/conventions/test_shoc_standard.py::test_grid_kind_and_size",
"tests/conventions/test_shoc_standard.py::test_selector_for_index[index0-selector0]",
"tests/conventions/test_shoc_standard.py::test_selector_for_index[index1-selector1]",
"tests/conventions/test_shoc_standard.py::test_selector_for_index[index2-selector2]",
"tests/conventions/test_shoc_standard.py::test_selector_for_index[index3-selector3]",
"tests/conventions/test_shoc_standard.py::test_select_index_face",
"tests/conventions/test_shoc_standard.py::test_select_index_edge",
"tests/conventions/test_shoc_standard.py::test_select_index_grid",
"tests/conventions/test_shoc_standard.py::test_drop_geometry",
"tests/conventions/test_shoc_standard.py::test_values",
"tests/conventions/test_shoc_standard.py::test_plot_on_figure",
"tests/conventions/test_shoc_standard.py::test_make_clip_mask",
"tests/conventions/test_shoc_standard.py::test_apply_clip_mask"
]
| {
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false
} | 2024-01-11 02:05:12+00:00 | bsd-3-clause | 1,729 |
|
csparpa__pyowm-189 | diff --git a/pyowm/utils/temputils.py b/pyowm/utils/temputils.py
index 58c4ea9..8bc29c3 100644
--- a/pyowm/utils/temputils.py
+++ b/pyowm/utils/temputils.py
@@ -1,11 +1,15 @@
"""
-Module containing utility functions for temperature units conversion
+Module containing utility functions for temperature and wind units conversion
"""
+# Temperature coneversion constants
KELVIN_OFFSET = 273.15
FAHRENHEIT_OFFSET = 32.0
FAHRENHEIT_DEGREE_SCALE = 1.8
+# Wind speed conversion constants
+MILES_PER_HOUR_FOR_ONE_METER_PER_SEC = 2.23694
+
def kelvin_dict_to(d, target_temperature_unit):
"""
@@ -66,3 +70,24 @@ def kelvin_to_fahrenheit(kelvintemp):
fahrenheittemp = (kelvintemp - KELVIN_OFFSET) * \
FAHRENHEIT_DEGREE_SCALE + FAHRENHEIT_OFFSET
return float("{0:.2f}".format(fahrenheittemp))
+
+
+def metric_wind_dict_to_imperial(d):
+ """
+ Converts all the wind values in a dict from meters/sec (metric measurement
+ system) to miles/hour (imperial measurement system)
+ .
+
+ :param d: the dictionary containing metric values
+ :type d: dict
+ :returns: a dict with the same keys as the input dict and values converted
+ to miles/hour
+
+ """
+ result = dict()
+ for key, value in d.items():
+ if key != 'deg': # do not convert wind degree
+ result[key] = value * MILES_PER_HOUR_FOR_ONE_METER_PER_SEC
+ else:
+ result[key] = value
+ return result
diff --git a/pyowm/webapi25/weather.py b/pyowm/webapi25/weather.py
index ddd9c39..cfd3962 100644
--- a/pyowm/webapi25/weather.py
+++ b/pyowm/webapi25/weather.py
@@ -163,13 +163,22 @@ class Weather(object):
"""
return self._snow
- def get_wind(self):
+ def get_wind(self, unit='meters_sec'):
"""Returns a dict containing wind info
-
+
+ :param unit: the unit of measure for the wind values. May be:
+ '*meters_sec*' (default) or '*miles_hour*'
+ :type unit: str
:returns: a dict containing wind info
"""
- return self._wind
+ if unit == 'meters_sec':
+ return self._wind
+ elif unit == 'miles_hour':
+ wind_dict = {k: self._wind[k] for k in self._wind if self._wind[k] is not None}
+ return temputils.metric_wind_dict_to_imperial(wind_dict)
+ else:
+ raise ValueError("Invalid value for target wind conversion unit")
def get_humidity(self):
"""Returns the atmospheric humidity as an int
| csparpa/pyowm | 93e2b8b77f96abc0428c8817ac411dc77169c6fc | diff --git a/tests/unit/utils/test_temputils.py b/tests/unit/utils/test_temputils.py
index e5bd43c..92a2aa9 100644
--- a/tests/unit/utils/test_temputils.py
+++ b/tests/unit/utils/test_temputils.py
@@ -48,3 +48,17 @@ class TestTempUtils(unittest.TestCase):
def test_kelvin_to_fahrenheit_fails_with_negative_values(self):
self.assertRaises(ValueError, temputils.kelvin_to_fahrenheit, -137.0)
+
+ def test_metric_wind_dict_to_imperial(self):
+ input = {
+ 'speed': 2,
+ 'gust': 3,
+ 'deg': 7.89
+ }
+ expected = {
+ 'speed': 4.47388,
+ 'gust': 6.71082,
+ 'deg': 7.89
+ }
+ result = temputils.metric_wind_dict_to_imperial(input)
+ self.assertEqual(expected, result)
diff --git a/tests/unit/webapi25/json_test_dumps.py b/tests/unit/webapi25/json_test_dumps.py
index df2d2cb..448f7e7 100644
--- a/tests/unit/webapi25/json_test_dumps.py
+++ b/tests/unit/webapi25/json_test_dumps.py
@@ -15,7 +15,7 @@ WEATHER_JSON_DUMP = '{"status": "Clouds", "visibility_distance": 1000, ' \
'{"press": 1030.119, "sea_level": 1038.589}, ' \
'"sunrise_time": 1378449600, "heat_index": 40.0, ' \
'"weather_icon_name": "04d", "humidity": 57, "wind": ' \
- '{"speed": 1.1, "deg": 252.002}}'
+ '{"speed": 1.1, "deg": 252.002, "gust": 2.09}}'
OBSERVATION_JSON_DUMP = '{"reception_time": 1234567, "Location": ' \
'{"country": "UK", "name": "test", "coordinates": ' \
diff --git a/tests/unit/webapi25/test_weather.py b/tests/unit/webapi25/test_weather.py
index a3ffa7c..9bb6319 100644
--- a/tests/unit/webapi25/test_weather.py
+++ b/tests/unit/webapi25/test_weather.py
@@ -6,6 +6,7 @@ import unittest
from pyowm.webapi25.weather import Weather, weather_from_dictionary
from pyowm.utils.timeformatutils import UTC
from tests.unit.webapi25.json_test_dumps import WEATHER_JSON_DUMP
+from tests.unit.webapi25.xml_test_dumps import WEATHER_XML_DUMP
from datetime import datetime
@@ -22,7 +23,8 @@ class TestWeather(unittest.TestCase):
__test_clouds = 67
__test_rain = {"all": 20}
__test_snow = {"all": 0}
- __test_wind = {"deg": 252.002, "speed": 1.100}
+ __test_wind = {"deg": 252.002, "speed": 1.100, "gust": 2.09}
+ __test_imperial_wind = {"deg": 252.002, "speed": 2.460634, "gust": 4.6752046}
__test_humidity = 57
__test_pressure = {"press": 1030.119, "sea_level": 1038.589}
__test_temperature = {"temp": 294.199, "temp_kf": -1.899,
@@ -380,6 +382,21 @@ class TestWeather(unittest.TestCase):
self.assertRaises(ValueError, Weather.get_temperature,
self.__test_instance, 'xyz')
+ def test_returning_different_units_for_wind_values(self):
+ result_imperial = self.__test_instance.get_wind(unit='miles_hour')
+ result_metric = self.__test_instance.get_wind(unit='meters_sec')
+ result_unspecified = self.__test_instance.get_wind()
+ self.assertEqual(result_unspecified, result_metric)
+ for item in self.__test_wind:
+ self.assertEqual(result_metric[item],
+ self.__test_wind[item])
+ self.assertEqual(result_imperial[item],
+ self.__test_imperial_wind[item])
+
+ def test_get_wind_fails_with_unknown_units(self):
+ self.assertRaises(ValueError, Weather.get_wind,
+ self.__test_instance, 'xyz')
+
# Test JSON and XML comparisons by ordering strings (this overcomes
# interpeter-dependant serialization of XML/JSON objects)
diff --git a/tests/unit/webapi25/xml_test_dumps.py b/tests/unit/webapi25/xml_test_dumps.py
index c393de8..08088b7 100644
--- a/tests/unit/webapi25/xml_test_dumps.py
+++ b/tests/unit/webapi25/xml_test_dumps.py
@@ -6,7 +6,7 @@ LOCATION_XML_DUMP = """<?xml version='1.0' encoding='utf8'?>
<location xmlns:l="http://github.com/csparpa/pyowm/tree/master/pyowm/webapi25/xsd/location.xsd"><l:name>London</l:name><l:coordinates><l:lon>12.3</l:lon><l:lat>43.7</l:lat></l:coordinates><l:ID>1234</l:ID><l:country>UK</l:country></location>"""
WEATHER_XML_DUMP = """<?xml version='1.0' encoding='utf8'?>
-<weather xmlns:w="http://github.com/csparpa/pyowm/tree/master/pyowm/webapi25/xsd/weather.xsd"><w:status>Clouds</w:status><w:weather_code>804</w:weather_code><w:rain><w:all>20</w:all></w:rain><w:snow><w:all>0</w:all></w:snow><w:pressure><w:press>1030.119</w:press><w:sea_level>1038.589</w:sea_level></w:pressure><w:sunrise_time>1378449600</w:sunrise_time><w:weather_icon_name>04d</w:weather_icon_name><w:clouds>67</w:clouds><w:temperature><w:temp_kf>-1.899</w:temp_kf><w:temp_min>294.199</w:temp_min><w:temp>294.199</w:temp><w:temp_max>296.098</w:temp_max></w:temperature><w:detailed_status>Overcast clouds</w:detailed_status><w:reference_time>1378459200</w:reference_time><w:sunset_time>1378496400</w:sunset_time><w:humidity>57</w:humidity><w:wind><w:speed>1.1</w:speed><w:deg>252.002</w:deg></w:wind><w:visibility_distance>1000</w:visibility_distance><w:dewpoint>300.0</w:dewpoint><w:humidex>298.0</w:humidex><w:heat_index>40.0</w:heat_index></weather>"""
+<weather xmlns:w="http://github.com/csparpa/pyowm/tree/master/pyowm/webapi25/xsd/weather.xsd"><w:status>Clouds</w:status><w:weather_code>804</w:weather_code><w:rain><w:all>20</w:all></w:rain><w:snow><w:all>0</w:all></w:snow><w:pressure><w:press>1030.119</w:press><w:sea_level>1038.589</w:sea_level></w:pressure><w:sunrise_time>1378449600</w:sunrise_time><w:weather_icon_name>04d</w:weather_icon_name><w:clouds>67</w:clouds><w:temperature><w:temp_kf>-1.899</w:temp_kf><w:temp_min>294.199</w:temp_min><w:temp>294.199</w:temp><w:temp_max>296.098</w:temp_max></w:temperature><w:detailed_status>Overcast clouds</w:detailed_status><w:reference_time>1378459200</w:reference_time><w:sunset_time>1378496400</w:sunset_time><w:humidity>57</w:humidity><w:wind><w:speed>1.1</w:speed><w:deg>252.002</w:deg><w:gust>2.09</w:gust></w:wind><w:visibility_distance>1000</w:visibility_distance><w:dewpoint>300.0</w:dewpoint><w:humidex>298.0</w:humidex><w:heat_index>40.0</w:heat_index></weather>"""
OBSERVATION_XML_DUMP = """<?xml version='1.0' encoding='utf8'?>
<observation xmlns:o="http://github.com/csparpa/pyowm/tree/master/pyowm/webapi25/xsd/observation.xsd"><o:reception_time>1234567</o:reception_time><o:location><o:name>test</o:name><o:coordinates><o:lon>12.3</o:lon><o:lat>43.7</o:lat></o:coordinates><o:ID>987</o:ID><o:country>UK</o:country></o:location><o:weather><o:status>Clouds</o:status><o:weather_code>804</o:weather_code><o:rain><o:all>20</o:all></o:rain><o:snow><o:all>0</o:all></o:snow><o:pressure><o:press>1030.119</o:press><o:sea_level>1038.589</o:sea_level></o:pressure><o:sunrise_time>1378449600</o:sunrise_time><o:weather_icon_name>04d</o:weather_icon_name><o:clouds>67</o:clouds><o:temperature><o:temp_kf>-1.899</o:temp_kf><o:temp_min>294.199</o:temp_min><o:temp>294.199</o:temp><o:temp_max>296.098</o:temp_max></o:temperature><o:detailed_status>Overcast clouds</o:detailed_status><o:reference_time>1378459200</o:reference_time><o:sunset_time>1378496400</o:sunset_time><o:humidity>57</o:humidity><o:wind><o:speed>1.1</o:speed><o:deg>252.002</o:deg></o:wind><o:visibility_distance>1000</o:visibility_distance><o:dewpoint>300.0</o:dewpoint><o:humidex>298.0</o:humidex><o:heat_index>296.0</o:heat_index></o:weather></observation>"""
| [Feature suggestion] Change wind speed unit
While `get_temperature() `supports unit parameter, `get_wind()` does not support it. OWM has wind speed unit available as Imperial (miles/hour) or Metric (meter/sec) unit.
Suggested implementation:
`w.get_wind(unit = 'Imperial')` or
`w.get_wind(unit = 'miles/hour')` or
`w.get_wind('Imperial')`
References:
[https://openweathermap.org/weather-data](url) | 0.0 | 93e2b8b77f96abc0428c8817ac411dc77169c6fc | [
"tests/unit/utils/test_temputils.py::TestTempUtils::test_metric_wind_dict_to_imperial",
"tests/unit/webapi25/test_weather.py::TestWeather::test_get_wind_fails_with_unknown_units",
"tests/unit/webapi25/test_weather.py::TestWeather::test_returning_different_units_for_wind_values"
]
| [
"tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_dict_to",
"tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_dict_to_fails_with_unknown_temperature_units",
"tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_to_celsius",
"tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_to_celsius_fails_with_negative_values",
"tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_to_fahrenheit",
"tests/unit/utils/test_temputils.py::TestTempUtils::test_kelvin_to_fahrenheit_fails_with_negative_values",
"tests/unit/webapi25/test_weather.py::TestWeather::test_from_dictionary",
"tests/unit/webapi25/test_weather.py::TestWeather::test_from_dictionary_when_data_fields_are_none",
"tests/unit/webapi25/test_weather.py::TestWeather::test_get_reference_time_fails_with_unknown_timeformat",
"tests/unit/webapi25/test_weather.py::TestWeather::test_get_reference_time_returning_different_formats",
"tests/unit/webapi25/test_weather.py::TestWeather::test_get_sunrise_time_fails_with_unknown_timeformat",
"tests/unit/webapi25/test_weather.py::TestWeather::test_get_sunrise_time_returning_different_formats",
"tests/unit/webapi25/test_weather.py::TestWeather::test_get_sunset_time_fails_with_unknown_timeformat",
"tests/unit/webapi25/test_weather.py::TestWeather::test_get_sunset_time_returning_different_formats",
"tests/unit/webapi25/test_weather.py::TestWeather::test_get_temperature_fails_with_unknown_units",
"tests/unit/webapi25/test_weather.py::TestWeather::test_getters_return_expected_data",
"tests/unit/webapi25/test_weather.py::TestWeather::test_init_fails_when_negative_data_provided",
"tests/unit/webapi25/test_weather.py::TestWeather::test_init_stores_negative_sunrise_time_as_none",
"tests/unit/webapi25/test_weather.py::TestWeather::test_init_stores_negative_sunset_time_as_none",
"tests/unit/webapi25/test_weather.py::TestWeather::test_init_when_wind_is_none",
"tests/unit/webapi25/test_weather.py::TestWeather::test_returning_different_units_for_temperatures",
"tests/unit/webapi25/test_weather.py::TestWeather::test_to_JSON"
]
| {
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false
} | 2017-05-18 20:43:27+00:00 | mit | 1,730 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.