From 9ee423cb17f54c959d691888a78063464d186621 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 1 Jan 2020 20:27:35 +0530 Subject: [PATCH] Added some fixes and quality tests (#78) * updated AUTHORS * fixed documentation * Added tests for presence of tabs --- AUTHORS | 3 ++- .../miscellaneous_data_structures/stack.py | 2 +- pydatastructs/utils/tests/test_code_quality.py | 17 ++++++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index edf1650a9..8af2532c4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,4 +2,5 @@ Gagandeep Singh Kartikei Mittal Umesh<23umesh.here@gmail.com> Rohan Singh -Tarun Singh Tomar +Tarun Singh Tomar +Saptashrungi Birajdar diff --git a/pydatastructs/miscellaneous_data_structures/stack.py b/pydatastructs/miscellaneous_data_structures/stack.py index 6899eb774..74f3b7ed4 100644 --- a/pydatastructs/miscellaneous_data_structures/stack.py +++ b/pydatastructs/miscellaneous_data_structures/stack.py @@ -19,7 +19,7 @@ class Stack(object): By default, 'array' Currently only supports 'array' implementation. - items : DynamicOneDimensionalArray + items : list/tuple Optional, by default, None The inital items in the stack. For array implementation. diff --git a/pydatastructs/utils/tests/test_code_quality.py b/pydatastructs/utils/tests/test_code_quality.py index 16f15a2ba..74a6a5e82 100644 --- a/pydatastructs/utils/tests/test_code_quality.py +++ b/pydatastructs/utils/tests/test_code_quality.py @@ -12,8 +12,9 @@ def _list_files(): py_files.append(os.path.join(dirpath, _file)) return py_files +py_files = _list_files() + def test_trailing_white_spaces(): - py_files = _list_files() for file_path in py_files: file = open(file_path, "r") line = file.readline() @@ -26,7 +27,6 @@ def test_trailing_white_spaces(): file.close() def test_final_new_lines(): - py_files = _list_files() for file_path in py_files: file = open(file_path, "r") lines = [] @@ -42,7 +42,6 @@ def test_final_new_lines(): file.close() def test_comparison_True_False_None(): - py_files = _list_files() for file_path in py_files: if file_path.find("test_code_quality.py") == -1: file = open(file_path, "r") @@ -59,3 +58,15 @@ def test_comparison_True_False_None(): %(file_path, line) line = file.readline() file.close() + +def test_presence_of_tabs(): + for file_path in py_files: + file = open(file_path, "r") + line = file.readline() + while line != "": + line = file.readline() + if (line.find('\t') != -1): + assert False, "Tab present at %s in %s. " \ + "Configure your editor to use " \ + "white spaces." + file.close()