Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions python/pyspark/errors/error_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@
"Argument `<arg_name>` must be a DataFrame, got <arg_type>."
]
},
"NOT_A_DATAFRAME" : {
"message" : [
"Argument `<arg_name>` should be a DataFrame, got <arg_type>."
]
},
"NOT_A_DICT" : {
"message" : [
"Argument `<arg_name>` should be a dict, got <arg_type>."
Expand Down
15 changes: 14 additions & 1 deletion python/pyspark/errors/tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
# limitations under the License.
#

import json
import unittest

from pyspark.errors.error_classes import ERROR_CLASSES_JSON
from pyspark.errors.utils import ErrorClassesReader


class ErrorsTest(unittest.TestCase):
def test_error_classes(self):
def test_error_classes_sorted(self):
# Test error classes is sorted alphabetically
error_reader = ErrorClassesReader()
error_class_names = list(error_reader.error_info_map.keys())
Expand All @@ -33,6 +35,17 @@ def test_error_classes(self):
f"after [{error_class_names[i + 1]}]",
)

def test_error_classes_duplicated(self):
# Test error classes is not duplicated
def detect_duplication(pairs):
error_classes_json = {}
for name, message in pairs:
self.assertTrue(name not in error_classes_json, f"Duplicate error class: {name}")
error_classes_json[name] = message
return error_classes_json

json.loads(ERROR_CLASSES_JSON, object_pairs_hook=detect_duplication)


if __name__ == "__main__":
import unittest
Expand Down