From ef5fa30c7e84b7527430492166f885fb4c72a485 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Mon, 18 Feb 2019 20:03:59 -0500 Subject: [PATCH 01/43] remove word from custom list, remove list of words New features * The remove_word() method now can remove words from an instance's custom_censor_list if it's used * New argument - Universal, default True: if True, remove word from wherever it is; namely extra_censor_list if applicable * New method - remove_word_list() - remove a list of words, following similar format as remove_word() --- profanityfilter/profanityfilter.py | 32 +++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 497e473..9fb6549 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -53,9 +53,35 @@ def append_words(self, word_list): """Define a custom list of profane words to be used in conjunction with the default list.""" self._extra_censor_list.extend(word_list) - def remove_word(self, word): - """Remove given word from censor list.""" - self._censor_list.remove(word) + def remove_word(self, word, universal=True): + """Remove given word from censor list. + + Universal: + - if True, remove word from extra_censor_list if word is there + - if False, only look in default/custom censor list""" + if word in _extra_censor_list and universal: + extra_censor_list.remove(word) + else: + if self._custom_censor_list: #NEW - now supports word removal from custom list, if applicable - saves defining new lists to remove words from custom list + self._custom_censor_list.remove(word) + else: + self._censor_list.remove(word) #This is the only place the code would check previously + + def remove_word_list(self, word_list, universal=True) + """Remove given list of words from censor list. + + Universal: + - if True, remove word from extra_censor_list if word is there + This operation may be slower because each word is removed individually due to possible differences in storage location + - if False, only look in default/custom censor list""" + if universal: + for a in word_list: + remove_word(a) + else: + if self._custom_censor_list: + self._custom_censor_list = [a for a in self._custom_censor_list if a not in word_list] + else: + self._censor_list = [a for a in self._censor_list if a not in word_list] def set_censor(self, character): """Replaces the original censor character '*' with ``character``.""" From 9cf048e5b9fa0cc9f82841beb73cd043bd0c86bb Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Tue, 19 Feb 2019 08:19:14 -0500 Subject: [PATCH 02/43] remove word[s] from custom or extra list Updated remove_word(): *If _custom_censor_list is used, remove words from there instead of returning error for value not in _censor_list *New arg - anywhere: If true, remove words from _extra_censor_list if word is there (checks there first) *Updated docstring as appropriate New method remove_word_list(): *Similar to remove_word(), but pass a list instead of string --- profanityfilter/profanityfilter.py | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 9fb6549..34fba0b 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -53,35 +53,35 @@ def append_words(self, word_list): """Define a custom list of profane words to be used in conjunction with the default list.""" self._extra_censor_list.extend(word_list) - def remove_word(self, word, universal=True): + def remove_word(self, word, anywhere=True): """Remove given word from censor list. - Universal: + Anywhere: - if True, remove word from extra_censor_list if word is there - if False, only look in default/custom censor list""" - if word in _extra_censor_list and universal: - extra_censor_list.remove(word) + if word in _extra_censor_list and universal: + extra_censor_list.remove(word) + else: + if self._custom_censor_list: #NEW - now supports word removal from custom list, if applicable - saves defining new lists to remove words from custom list + self._custom_censor_list.remove(word) else: - if self._custom_censor_list: #NEW - now supports word removal from custom list, if applicable - saves defining new lists to remove words from custom list - self._custom_censor_list.remove(word) - else: - self._censor_list.remove(word) #This is the only place the code would check previously + self._censor_list.remove(word) #This is the only place the code would check previously - def remove_word_list(self, word_list, universal=True) - """Remove given list of words from censor list. + def remove_word_list(self, word_list, anywhere=True): + """Remove given list of words from censor list. - Universal: + Anywhere: - if True, remove word from extra_censor_list if word is there This operation may be slower because each word is removed individually due to possible differences in storage location - if False, only look in default/custom censor list""" - if universal: - for a in word_list: - remove_word(a) + if universal: + for a in word_list: + remove_word(a) + else: + if self._custom_censor_list: + self._custom_censor_list = [a for a in self._custom_censor_list if a not in word_list] else: - if self._custom_censor_list: - self._custom_censor_list = [a for a in self._custom_censor_list if a not in word_list] - else: - self._censor_list = [a for a in self._censor_list if a not in word_list] + self._censor_list = [a for a in self._censor_list if a not in word_list] def set_censor(self, character): """Replaces the original censor character '*' with ``character``.""" From 60b1ad5d03f17761af366b1c3439a63aa5b0c50d Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Tue, 19 Feb 2019 18:52:34 -0500 Subject: [PATCH 03/43] remove word[s] from custom or extra censor list *If _custom_censor_list is used, remove words from there instead of returning error for value not in _censor_list *New arg - anywhere: If true, remove words from _extra_censor_list if word is there (checks there first) *Updated docstring as appropriate New method remove_word_list(): *Similar to remove_word(), but pass a list instead of string --- profanityfilter/profanityfilter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 34fba0b..76550d6 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -53,14 +53,14 @@ def append_words(self, word_list): """Define a custom list of profane words to be used in conjunction with the default list.""" self._extra_censor_list.extend(word_list) - def remove_word(self, word, anywhere=True): + def remove_word(self, word, anywhere=True): """Remove given word from censor list. Anywhere: - if True, remove word from extra_censor_list if word is there - if False, only look in default/custom censor list""" - if word in _extra_censor_list and universal: - extra_censor_list.remove(word) + if word in self._extra_censor_list and anywhere: + self._extra_censor_list.remove(word) else: if self._custom_censor_list: #NEW - now supports word removal from custom list, if applicable - saves defining new lists to remove words from custom list self._custom_censor_list.remove(word) @@ -74,9 +74,9 @@ def remove_word_list(self, word_list, anywhere=True): - if True, remove word from extra_censor_list if word is there This operation may be slower because each word is removed individually due to possible differences in storage location - if False, only look in default/custom censor list""" - if universal: + if anywhere: for a in word_list: - remove_word(a) + self.remove_word(a) else: if self._custom_censor_list: self._custom_censor_list = [a for a in self._custom_censor_list if a not in word_list] From 9da5a71d9ad5d58221db6349aec4a7e20efc9e10 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 11:54:27 -0500 Subject: [PATCH 04/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 76550d6..5bbd0e6 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -65,7 +65,7 @@ def remove_word(self, word, anywhere=True): if self._custom_censor_list: #NEW - now supports word removal from custom list, if applicable - saves defining new lists to remove words from custom list self._custom_censor_list.remove(word) else: - self._censor_list.remove(word) #This is the only place the code would check previously + self._censor_list.remove(word) def remove_word_list(self, word_list, anywhere=True): """Remove given list of words from censor list. From e59385cf0e2cd13ba872b95c099a127a0b82cd65 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 11:58:17 -0500 Subject: [PATCH 05/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 5bbd0e6..a912ffc 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -62,7 +62,7 @@ def remove_word(self, word, anywhere=True): if word in self._extra_censor_list and anywhere: self._extra_censor_list.remove(word) else: - if self._custom_censor_list: #NEW - now supports word removal from custom list, if applicable - saves defining new lists to remove words from custom list + if self._custom_censor_list: self._custom_censor_list.remove(word) else: self._censor_list.remove(word) From dfb920123885b1c61d27b0822107157c7e10129e Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 11:58:40 -0500 Subject: [PATCH 06/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index a912ffc..6c7f2a9 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -56,7 +56,7 @@ def append_words(self, word_list): def remove_word(self, word, anywhere=True): """Remove given word from censor list. - Anywhere: + - anywhere (bool): - if True, remove word from extra_censor_list if word is there - if False, only look in default/custom censor list""" if word in self._extra_censor_list and anywhere: From c5e07d69eb7ba4c28e451d75ea782ec7da72d63e Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 11:58:58 -0500 Subject: [PATCH 07/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 6c7f2a9..9f1e524 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -57,7 +57,8 @@ def remove_word(self, word, anywhere=True): """Remove given word from censor list. - anywhere (bool): - - if True, remove word from extra_censor_list if word is there + attempt removal from both, the extra censor list and the custom/default censor list + """ - if False, only look in default/custom censor list""" if word in self._extra_censor_list and anywhere: self._extra_censor_list.remove(word) From d104acdbaac854bc3de6dc74a23343d474363860 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 11:59:13 -0500 Subject: [PATCH 08/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 1 - 1 file changed, 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 9f1e524..40b7612 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -59,7 +59,6 @@ def remove_word(self, word, anywhere=True): - anywhere (bool): attempt removal from both, the extra censor list and the custom/default censor list """ - - if False, only look in default/custom censor list""" if word in self._extra_censor_list and anywhere: self._extra_censor_list.remove(word) else: From d84d22a69474221ddb64c5eb430c7ff3c6ae0860 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 12:03:25 -0500 Subject: [PATCH 09/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 40b7612..b7e8035 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -68,7 +68,8 @@ def remove_word(self, word, anywhere=True): self._censor_list.remove(word) def remove_word_list(self, word_list, anywhere=True): - """Remove given list of words from censor list. + """ + Remove given list of words from censor list. Anywhere: - if True, remove word from extra_censor_list if word is there From 0f6d25967a4ca61c812867645af2916b0e43dac8 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 12:03:53 -0500 Subject: [PATCH 10/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index b7e8035..1871029 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -71,7 +71,7 @@ def remove_word_list(self, word_list, anywhere=True): """ Remove given list of words from censor list. - Anywhere: + - anywhere (bool): - if True, remove word from extra_censor_list if word is there This operation may be slower because each word is removed individually due to possible differences in storage location - if False, only look in default/custom censor list""" From 9b2e2430446d4110b5bd6544496af918f3575df2 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 12:04:22 -0500 Subject: [PATCH 11/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 1871029..dd81f3b 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -54,7 +54,8 @@ def append_words(self, word_list): self._extra_censor_list.extend(word_list) def remove_word(self, word, anywhere=True): - """Remove given word from censor list. + """ + Remove given word from censor list. - anywhere (bool): attempt removal from both, the extra censor list and the custom/default censor list From 4ecf7f92e2f07906f0ff5b2989ec9fd44e50dfe1 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 12:05:44 -0500 Subject: [PATCH 12/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index dd81f3b..50dd23e 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -68,7 +68,7 @@ def remove_word(self, word, anywhere=True): else: self._censor_list.remove(word) - def remove_word_list(self, word_list, anywhere=True): + def remove_words(self, word_list, anywhere=True): """ Remove given list of words from censor list. From 32a179b7bd88cbf2bc69d859b14f19fb36f0a89f Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Wed, 20 Feb 2019 12:16:14 -0500 Subject: [PATCH 13/43] remove word(s) from custom or extra censor list updated docstring for remove_words() --- profanityfilter/profanityfilter.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 50dd23e..4046f30 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -58,7 +58,7 @@ def remove_word(self, word, anywhere=True): Remove given word from censor list. - anywhere (bool): - attempt removal from both, the extra censor list and the custom/default censor list + attempt removal from both the extra censor list and the custom/default censor list """ if word in self._extra_censor_list and anywhere: self._extra_censor_list.remove(word) @@ -73,9 +73,10 @@ def remove_words(self, word_list, anywhere=True): Remove given list of words from censor list. - anywhere (bool): - - if True, remove word from extra_censor_list if word is there - This operation may be slower because each word is removed individually due to possible differences in storage location - - if False, only look in default/custom censor list""" + attempt removal from both the extra censor list and the custom/default censor list + - word_list (list): + the list of words to remove + """ if anywhere: for a in word_list: self.remove_word(a) From c4314e37cec402d2bf66caea0cbd957c68269814 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Wed, 20 Feb 2019 12:20:35 -0500 Subject: [PATCH 14/43] remove word(s) from custom or extra censor list optimized and compressed remove_words() code --- profanityfilter/profanityfilter.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 4046f30..6890fe5 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -77,14 +77,8 @@ def remove_words(self, word_list, anywhere=True): - word_list (list): the list of words to remove """ - if anywhere: - for a in word_list: - self.remove_word(a) - else: - if self._custom_censor_list: - self._custom_censor_list = [a for a in self._custom_censor_list if a not in word_list] - else: - self._censor_list = [a for a in self._censor_list if a not in word_list] + for word in word_list: + self.remove_word(word, anywhere=anywhere) def set_censor(self, character): """Replaces the original censor character '*' with ``character``.""" From 84fece530b39df377ff99fd7bb0c105657693728 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Wed, 20 Feb 2019 14:29:58 -0500 Subject: [PATCH 15/43] remove word(s) from custom or extra censor list Fixed indentation --- profanityfilter/profanityfilter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 6890fe5..710f488 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -53,13 +53,13 @@ def append_words(self, word_list): """Define a custom list of profane words to be used in conjunction with the default list.""" self._extra_censor_list.extend(word_list) - def remove_word(self, word, anywhere=True): + def remove_word(self, word, anywhere=True): """ Remove given word from censor list. - anywhere (bool): attempt removal from both the extra censor list and the custom/default censor list - """ + """ if word in self._extra_censor_list and anywhere: self._extra_censor_list.remove(word) else: @@ -68,7 +68,7 @@ def remove_word(self, word, anywhere=True): else: self._censor_list.remove(word) - def remove_words(self, word_list, anywhere=True): + def remove_words(self, word_list, anywhere=True): """ Remove given list of words from censor list. From dcd6cd7350125c1cbd50c366b712f4f0ccb28410 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Wed, 20 Feb 2019 14:40:12 -0500 Subject: [PATCH 16/43] remove word(s) from custom or extra censor list fixed docstring indentation --- profanityfilter/profanityfilter.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 710f488..f4a9369 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -57,8 +57,8 @@ def remove_word(self, word, anywhere=True): """ Remove given word from censor list. - - anywhere (bool): - attempt removal from both the extra censor list and the custom/default censor list + - anywhere (bool): + attempt removal from both the extra censor list and the custom/default censor list """ if word in self._extra_censor_list and anywhere: self._extra_censor_list.remove(word) @@ -72,10 +72,10 @@ def remove_words(self, word_list, anywhere=True): """ Remove given list of words from censor list. - - anywhere (bool): - attempt removal from both the extra censor list and the custom/default censor list - - word_list (list): - the list of words to remove + - anywhere (bool): + attempt removal from both the extra censor list and the custom/default censor list + - word_list (list): + the list of words to remove """ for word in word_list: self.remove_word(word, anywhere=anywhere) From c86ea047dbfdc577099fb5d5e13bb3be2a3052af Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Wed, 20 Feb 2019 14:50:36 -0500 Subject: [PATCH 17/43] remove word(s) from custom or extra censor list --- profanityfilter/profanityfilter.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index f4a9369..58b36ec 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -56,7 +56,6 @@ def append_words(self, word_list): def remove_word(self, word, anywhere=True): """ Remove given word from censor list. - - anywhere (bool): attempt removal from both the extra censor list and the custom/default censor list """ @@ -71,7 +70,6 @@ def remove_word(self, word, anywhere=True): def remove_words(self, word_list, anywhere=True): """ Remove given list of words from censor list. - - anywhere (bool): attempt removal from both the extra censor list and the custom/default censor list - word_list (list): From 7d96a3e66cc9b04a9b5c59c3e69017df7cce356c Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Wed, 20 Feb 2019 16:11:02 -0500 Subject: [PATCH 18/43] remove word(s) from custom or extra censor list Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- profanityfilter/profanityfilter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profanityfilter/profanityfilter.py b/profanityfilter/profanityfilter.py index 58b36ec..2009087 100644 --- a/profanityfilter/profanityfilter.py +++ b/profanityfilter/profanityfilter.py @@ -62,7 +62,7 @@ def remove_word(self, word, anywhere=True): if word in self._extra_censor_list and anywhere: self._extra_censor_list.remove(word) else: - if self._custom_censor_list: + if word in self._custom_censor_list: self._custom_censor_list.remove(word) else: self._censor_list.remove(word) From 06f5b5dbe85c47ed314dc2a633542ecd08aecb3f Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Sat, 23 Feb 2019 22:14:52 -0500 Subject: [PATCH 19/43] remove word(s) from custom or extra censor list Updated remove_word() for new features - removing from _extra_censor_list Added remove_words() --- tests/test_profanity.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 338f6dc..7e3da9f 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -2,7 +2,7 @@ import unittest pf = ProfanityFilter() -TEST_STATEMENT = "Hey, I like unicorns, chocolate and oranges, Turd!" +TEST_STATEMENT = "Hey, I like unicorns, chocolate and oranges, big old Turd!" CLEAN_STATEMENT = "Hey there, I like chocolate too mate." def update_censored(pf_instance=pf): @@ -28,10 +28,10 @@ def test_censor(self): "My email is fuckyoubitch@****.com" ) update_censored() - self.assertEqual(censored, "Hey, I like unicorns, chocolate and oranges, ****!") + self.assertEqual(censored, "Hey, I like unicorns, chocolate and oranges, big old ****!") pf.set_censor("#") update_censored() - self.assertEqual(censored, "Hey, I like unicorns, chocolate and oranges, ####!") + self.assertEqual(censored, "Hey, I like unicorns, chocolate and oranges, big old ####!") def test_define_words(self): # Testing pluralization here as well @@ -42,18 +42,34 @@ def test_define_words(self): self.assertTrue("Turd" in censored) def test_append_words(self): - pf.append_words(["Hey", "like"]) + pf.append_words(["Hey", "like", "old"]) update_censored() self.assertTrue("oranges" in censored) self.assertFalse("Hey" in censored) self.assertFalse("like" in censored) self.assertFalse("Turd" in censored) + self.assertTrue("big" in censored) + self.assertFalse("old" in censored) def test_remove_word(self): - self.assertTrue("Turd" in censored) + self.assertFalse("Turd" in censored) + self.assertFalse("old" in censored) pf.remove_word("turd") + pf.remove_word("old") update_censored() self.assertTrue("Turd" in censored) + self.assertTrue("old" in censored) + + def test_remove_words(self): + self.assertFalse("like" in censored) + self.assertTrue("there" in censored) + self.assertFalse("xxx" in censored) + pf.remove_words(["chocolate", "like", "xxx"]) + update_censored() + self.assertTrue("there" in censored) + self.assertTrue("like" in censored) + self.assertTrue("xxx" in censored) + self.assertFalse("unicorn" in censored) def test_restore_words(self): pf.define_words(["cupcakes"]) From bfe850aec6d7d5d0361482c2996962e39bbe707e Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Sat, 23 Feb 2019 22:25:18 -0500 Subject: [PATCH 20/43] remove word(s) from custom or extra censor list fixed assertion errors --- tests/test_profanity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 7e3da9f..d8b94d8 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -52,7 +52,7 @@ def test_append_words(self): self.assertFalse("old" in censored) def test_remove_word(self): - self.assertFalse("Turd" in censored) + self.assertTrue("Turd" in censored) self.assertFalse("old" in censored) pf.remove_word("turd") pf.remove_word("old") @@ -61,7 +61,7 @@ def test_remove_word(self): self.assertTrue("old" in censored) def test_remove_words(self): - self.assertFalse("like" in censored) + self.assertTrue("like" in censored) self.assertTrue("there" in censored) self.assertFalse("xxx" in censored) pf.remove_words(["chocolate", "like", "xxx"]) From 7a2770e6db84f6eb4c3f55f56d6352537443c949 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Sat, 23 Feb 2019 22:37:21 -0500 Subject: [PATCH 21/43] Update test_profanity.py --- tests/test_profanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index d8b94d8..6470441 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -62,7 +62,7 @@ def test_remove_word(self): def test_remove_words(self): self.assertTrue("like" in censored) - self.assertTrue("there" in censored) + self.assertTrue("I" in censored) self.assertFalse("xxx" in censored) pf.remove_words(["chocolate", "like", "xxx"]) update_censored() From 9f020043c99ece289ca5bc5e46bbf2842d9fcc67 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Thu, 28 Feb 2019 08:35:17 -0500 Subject: [PATCH 22/43] remove word(s) from custom or extra censor list fixed errors --- tests/test_profanity.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 6470441..32bde9a 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -2,7 +2,7 @@ import unittest pf = ProfanityFilter() -TEST_STATEMENT = "Hey, I like unicorns, chocolate and oranges, big old Turd!" +TEST_STATEMENT = "Hey, I like unicorns, chocolate and oranges, Turd!" CLEAN_STATEMENT = "Hey there, I like chocolate too mate." def update_censored(pf_instance=pf): @@ -28,10 +28,10 @@ def test_censor(self): "My email is fuckyoubitch@****.com" ) update_censored() - self.assertEqual(censored, "Hey, I like unicorns, chocolate and oranges, big old ****!") + self.assertEqual(censored, "Hey, I like unicorns, chocolate and oranges, ****!") pf.set_censor("#") update_censored() - self.assertEqual(censored, "Hey, I like unicorns, chocolate and oranges, big old ####!") + self.assertEqual(censored, "Hey, I like unicorns, chocolate and oranges, ####!") def test_define_words(self): # Testing pluralization here as well @@ -42,33 +42,28 @@ def test_define_words(self): self.assertTrue("Turd" in censored) def test_append_words(self): - pf.append_words(["Hey", "like", "old"]) + pf.append_words(["Hey", "like", "oranges"]) update_censored() - self.assertTrue("oranges" in censored) + self.assertFalse("oranges" in censored) self.assertFalse("Hey" in censored) - self.assertFalse("like" in censored) + self.assertTrue("and" in censored) self.assertFalse("Turd" in censored) - self.assertTrue("big" in censored) - self.assertFalse("old" in censored) def test_remove_word(self): self.assertTrue("Turd" in censored) - self.assertFalse("old" in censored) pf.remove_word("turd") - pf.remove_word("old") + pf.remove_word("oranges") update_censored() self.assertTrue("Turd" in censored) - self.assertTrue("old" in censored) + self.assertTrue("oranges" in censored) def test_remove_words(self): self.assertTrue("like" in censored) self.assertTrue("I" in censored) - self.assertFalse("xxx" in censored) - pf.remove_words(["chocolate", "like", "xxx"]) + pf.remove_words(["chocolate", "oranges"]) update_censored() self.assertTrue("there" in censored) self.assertTrue("like" in censored) - self.assertTrue("xxx" in censored) self.assertFalse("unicorn" in censored) def test_restore_words(self): From 2dbf0d38387de50b258a7b2ad428f2106e2142f2 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Fri, 1 Mar 2019 11:35:31 -0500 Subject: [PATCH 23/43] remove word(s) from custom or extra censor list program now properly tests using both values of the 'anywhere' bool for remove_word() and remove_words() --- tests/test_profanity.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 32bde9a..5d1ad36 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -35,14 +35,14 @@ def test_censor(self): def test_define_words(self): # Testing pluralization here as well - pf.define_words(["unicorn", "chocolate"]) + pf.define_words(["unicorn", "chocolate", "centaur"]) update_censored() self.assertFalse("unicorns" in censored) self.assertFalse("chocolate" in censored) self.assertTrue("Turd" in censored) def test_append_words(self): - pf.append_words(["Hey", "like", "oranges"]) + pf.append_words(["Hey", "like", "oranges", "potato", "racecar"]) update_censored() self.assertFalse("oranges" in censored) self.assertFalse("Hey" in censored) @@ -51,20 +51,24 @@ def test_append_words(self): def test_remove_word(self): self.assertTrue("Turd" in censored) + self.assertTrue("potato" in pf.get_profane_words()) pf.remove_word("turd") + pf.remove_word("potato", anywhere=False) pf.remove_word("oranges") update_censored() self.assertTrue("Turd" in censored) - self.assertTrue("oranges" in censored) + self.assertFalse("oranges" in pf.get_profane_words()) + self.assertTrue("potato" in pf.get_profane_words()) def test_remove_words(self): self.assertTrue("like" in censored) - self.assertTrue("I" in censored) - pf.remove_words(["chocolate", "oranges"]) + self.assertTrue("chocalate" in pf.get_profane_words()) + pf.remove_words(["chocolate", "racecar"],anywhere=False) + pf.remove_words(["centaur", "hey"]) update_censored() - self.assertTrue("there" in censored) - self.assertTrue("like" in censored) - self.assertFalse("unicorn" in censored) + self.assertFalse("chocalate" in pf.get_profane_words()) + self.assertTrue("racecar" in pf.get_profane_words()) + self.assertFalse("centaur" in pf.get_profane_words()) def test_restore_words(self): pf.define_words(["cupcakes"]) From 182e2b1da0c00350b5a769696a06ab2096c4aad1 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Fri, 1 Mar 2019 12:48:08 -0500 Subject: [PATCH 24/43] remove word(s) from custom or extra censor list --- tests/test_profanity.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 5d1ad36..1691a72 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -48,6 +48,7 @@ def test_append_words(self): self.assertFalse("Hey" in censored) self.assertTrue("and" in censored) self.assertFalse("Turd" in censored) + self.assertTrue("racecar" in pf.get_profane_words()) def test_remove_word(self): self.assertTrue("Turd" in censored) From 2b1f533ede763a95fa15375f0d63f5feedd19cd4 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Fri, 1 Mar 2019 12:55:01 -0500 Subject: [PATCH 25/43] remove word(s) from custom or extra censor list fixed misspelling of 'chocolate' --- tests/test_profanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 1691a72..df83406 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -63,7 +63,7 @@ def test_remove_word(self): def test_remove_words(self): self.assertTrue("like" in censored) - self.assertTrue("chocalate" in pf.get_profane_words()) + self.assertTrue("chocolate" in pf.get_profane_words()) pf.remove_words(["chocolate", "racecar"],anywhere=False) pf.remove_words(["centaur", "hey"]) update_censored() From 835860b216a1d6ee16d6d17ab33b6c6cb658e3c7 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Fri, 1 Mar 2019 13:03:00 -0500 Subject: [PATCH 26/43] Update test_profanity.py --- tests/test_profanity.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index df83406..1c6d36d 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -48,6 +48,7 @@ def test_append_words(self): self.assertFalse("Hey" in censored) self.assertTrue("and" in censored) self.assertFalse("Turd" in censored) + self.assertTrue("potato" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) def test_remove_word(self): @@ -67,7 +68,7 @@ def test_remove_words(self): pf.remove_words(["chocolate", "racecar"],anywhere=False) pf.remove_words(["centaur", "hey"]) update_censored() - self.assertFalse("chocalate" in pf.get_profane_words()) + self.assertFalse("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) self.assertFalse("centaur" in pf.get_profane_words()) From 47afa1f6a42bde41d2c7fea8196ca48de2e53a0a Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Fri, 1 Mar 2019 13:19:50 -0500 Subject: [PATCH 27/43] remove word(s) from custom or extra censor list I think I finally realize how the testing works here --- tests/test_profanity.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 1c6d36d..14270ef 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -53,6 +53,8 @@ def test_append_words(self): def test_remove_word(self): self.assertTrue("Turd" in censored) + pf.append_words(["oranges", "potato"]) + update_censored() self.assertTrue("potato" in pf.get_profane_words()) pf.remove_word("turd") pf.remove_word("potato", anywhere=False) @@ -63,7 +65,9 @@ def test_remove_word(self): self.assertTrue("potato" in pf.get_profane_words()) def test_remove_words(self): - self.assertTrue("like" in censored) + pf.define_words(["chocolate", "centaur"]) + pf.append_words(["potato", "racecar", "hey"]) + update_censored() self.assertTrue("chocolate" in pf.get_profane_words()) pf.remove_words(["chocolate", "racecar"],anywhere=False) pf.remove_words(["centaur", "hey"]) From 9c8716daf753927e339eb1cfb20b91083bb8cd6b Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:16:36 -0500 Subject: [PATCH 28/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 14270ef..8ccf87a 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -42,7 +42,7 @@ def test_define_words(self): self.assertTrue("Turd" in censored) def test_append_words(self): - pf.append_words(["Hey", "like", "oranges", "potato", "racecar"]) + pf.append_words(["Hey", "like"]) update_censored() self.assertFalse("oranges" in censored) self.assertFalse("Hey" in censored) From 53ef717b286db77cc951d2ac07e0854d26e9c8e9 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:16:55 -0500 Subject: [PATCH 29/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 8ccf87a..f359792 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -44,7 +44,7 @@ def test_define_words(self): def test_append_words(self): pf.append_words(["Hey", "like"]) update_censored() - self.assertFalse("oranges" in censored) + self.assertTrue("oranges" in censored) self.assertFalse("Hey" in censored) self.assertTrue("and" in censored) self.assertFalse("Turd" in censored) From 3fb94f4bd6686fd653da38067742ed99537703ca Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:17:17 -0500 Subject: [PATCH 30/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index f359792..1e50065 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -46,7 +46,6 @@ def test_append_words(self): update_censored() self.assertTrue("oranges" in censored) self.assertFalse("Hey" in censored) - self.assertTrue("and" in censored) self.assertFalse("Turd" in censored) self.assertTrue("potato" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) From 4fc92216f4742de0360fa328c611404cf10a8777 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:17:31 -0500 Subject: [PATCH 31/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 1e50065..9c01d34 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -47,7 +47,6 @@ def test_append_words(self): self.assertTrue("oranges" in censored) self.assertFalse("Hey" in censored) self.assertFalse("Turd" in censored) - self.assertTrue("potato" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) def test_remove_word(self): From 339ad5cec8752546b5fc45c1fa9d509e82b5fc2a Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:17:44 -0500 Subject: [PATCH 32/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 9c01d34..0af9efd 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -47,7 +47,6 @@ def test_append_words(self): self.assertTrue("oranges" in censored) self.assertFalse("Hey" in censored) self.assertFalse("Turd" in censored) - self.assertTrue("racecar" in pf.get_profane_words()) def test_remove_word(self): self.assertTrue("Turd" in censored) From 878bd66464b8d2811736dcdf241e51e384b658fc Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:17:56 -0500 Subject: [PATCH 33/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 0af9efd..0fb63b5 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -52,7 +52,6 @@ def test_remove_word(self): self.assertTrue("Turd" in censored) pf.append_words(["oranges", "potato"]) update_censored() - self.assertTrue("potato" in pf.get_profane_words()) pf.remove_word("turd") pf.remove_word("potato", anywhere=False) pf.remove_word("oranges") From 9c67aa0543199b3ad15010a470c15ddc8f96e463 Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:18:07 -0500 Subject: [PATCH 34/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 0fb63b5..2062fe7 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -63,7 +63,6 @@ def test_remove_word(self): def test_remove_words(self): pf.define_words(["chocolate", "centaur"]) pf.append_words(["potato", "racecar", "hey"]) - update_censored() self.assertTrue("chocolate" in pf.get_profane_words()) pf.remove_words(["chocolate", "racecar"],anywhere=False) pf.remove_words(["centaur", "hey"]) From 21341beaf0f24c385540e71db45c4f25f0b8d93d Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:18:21 -0500 Subject: [PATCH 35/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 2062fe7..4612c1c 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -66,7 +66,6 @@ def test_remove_words(self): self.assertTrue("chocolate" in pf.get_profane_words()) pf.remove_words(["chocolate", "racecar"],anywhere=False) pf.remove_words(["centaur", "hey"]) - update_censored() self.assertFalse("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) self.assertFalse("centaur" in pf.get_profane_words()) From 285f7dbfbaf74447b358335f39b3a1e3baa44b6f Mon Sep 17 00:00:00 2001 From: "Areeb Beigh (Euphinx)" Date: Thu, 7 Mar 2019 21:18:31 -0500 Subject: [PATCH 36/43] Update tests/test_profanity.py Co-Authored-By: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> --- tests/test_profanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 4612c1c..0385734 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -64,7 +64,7 @@ def test_remove_words(self): pf.define_words(["chocolate", "centaur"]) pf.append_words(["potato", "racecar", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) - pf.remove_words(["chocolate", "racecar"],anywhere=False) + pf.remove_words(["chocolate", "racecar"], anywhere=False) pf.remove_words(["centaur", "hey"]) self.assertFalse("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) From b07d33970939cc4f0eb59798ef5616966d3aca64 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Thu, 14 Mar 2019 21:07:47 -0400 Subject: [PATCH 37/43] remove word(s) from custom or extra censor list Added assertRaise testing --- tests/test_profanity.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 0385734..920a68c 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -53,7 +53,7 @@ def test_remove_word(self): pf.append_words(["oranges", "potato"]) update_censored() pf.remove_word("turd") - pf.remove_word("potato", anywhere=False) + self.assertRaise(pf.remove_word("potato", anywhere=False)) pf.remove_word("oranges") update_censored() self.assertTrue("Turd" in censored) @@ -64,9 +64,9 @@ def test_remove_words(self): pf.define_words(["chocolate", "centaur"]) pf.append_words(["potato", "racecar", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) - pf.remove_words(["chocolate", "racecar"], anywhere=False) + self.assertRaise(pf.remove_words(["chocolate", "racecar"], anywhere=False)) pf.remove_words(["centaur", "hey"]) - self.assertFalse("chocolate" in pf.get_profane_words()) + self.assertTrue("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) self.assertFalse("centaur" in pf.get_profane_words()) From 714dcc2890f605446b00a4fa682441842ede6517 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Thu, 14 Mar 2019 21:12:32 -0400 Subject: [PATCH 38/43] remove word(s) from custom or extra censor list it's assert RAISES, not RAISE --- tests/test_profanity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 920a68c..60b2d6f 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -53,7 +53,7 @@ def test_remove_word(self): pf.append_words(["oranges", "potato"]) update_censored() pf.remove_word("turd") - self.assertRaise(pf.remove_word("potato", anywhere=False)) + self.assertRaises(pf.remove_word("potato", anywhere=False)) pf.remove_word("oranges") update_censored() self.assertTrue("Turd" in censored) @@ -64,7 +64,7 @@ def test_remove_words(self): pf.define_words(["chocolate", "centaur"]) pf.append_words(["potato", "racecar", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) - self.assertRaise(pf.remove_words(["chocolate", "racecar"], anywhere=False)) + self.assertRaises(pf.remove_words(["chocolate", "racecar"], anywhere=False)) pf.remove_words(["centaur", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) From f8c521fcf972cd7dc469b3d5546e3ec239196369 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Thu, 14 Mar 2019 21:18:16 -0400 Subject: [PATCH 39/43] remove word(s) from custom or extra censor list fixed improper uses of "raises" testing --- tests/test_profanity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 60b2d6f..6683ea8 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -53,7 +53,7 @@ def test_remove_word(self): pf.append_words(["oranges", "potato"]) update_censored() pf.remove_word("turd") - self.assertRaises(pf.remove_word("potato", anywhere=False)) + self.assertRaises(ValueError, pf.remove_word("potato", anywhere=False)) pf.remove_word("oranges") update_censored() self.assertTrue("Turd" in censored) @@ -64,7 +64,7 @@ def test_remove_words(self): pf.define_words(["chocolate", "centaur"]) pf.append_words(["potato", "racecar", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) - self.assertRaises(pf.remove_words(["chocolate", "racecar"], anywhere=False)) + self.assertRaises(ValueError, pf.remove_words(["chocolate", "racecar"], anywhere=False)) pf.remove_words(["centaur", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) From 3061172bad1a5c43876e0e850bb8db59492627b2 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Thu, 14 Mar 2019 21:26:15 -0400 Subject: [PATCH 40/43] remove word(s) from custom or extra censor list --- tests/test_profanity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 6683ea8..700f5ab 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -53,7 +53,7 @@ def test_remove_word(self): pf.append_words(["oranges", "potato"]) update_censored() pf.remove_word("turd") - self.assertRaises(ValueError, pf.remove_word("potato", anywhere=False)) + self.assertRaises(ValueError, pf.remove_word, ["potato", anywhere=False]) pf.remove_word("oranges") update_censored() self.assertTrue("Turd" in censored) @@ -64,7 +64,7 @@ def test_remove_words(self): pf.define_words(["chocolate", "centaur"]) pf.append_words(["potato", "racecar", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) - self.assertRaises(ValueError, pf.remove_words(["chocolate", "racecar"], anywhere=False)) + self.assertRaises(ValueError, pf.remove_words, [["chocolate", "racecar"], anywhere=False]) pf.remove_words(["centaur", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) From e551545623384882483d9fff7b137fd57647b64a Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Thu, 14 Mar 2019 21:38:45 -0400 Subject: [PATCH 41/43] Update test_profanity.py --- tests/test_profanity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 700f5ab..6683ea8 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -53,7 +53,7 @@ def test_remove_word(self): pf.append_words(["oranges", "potato"]) update_censored() pf.remove_word("turd") - self.assertRaises(ValueError, pf.remove_word, ["potato", anywhere=False]) + self.assertRaises(ValueError, pf.remove_word("potato", anywhere=False)) pf.remove_word("oranges") update_censored() self.assertTrue("Turd" in censored) @@ -64,7 +64,7 @@ def test_remove_words(self): pf.define_words(["chocolate", "centaur"]) pf.append_words(["potato", "racecar", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) - self.assertRaises(ValueError, pf.remove_words, [["chocolate", "racecar"], anywhere=False]) + self.assertRaises(ValueError, pf.remove_words(["chocolate", "racecar"], anywhere=False)) pf.remove_words(["centaur", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) From b0866e765be38a5f7c7570f26618ecd3a472f5bb Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Thu, 14 Mar 2019 21:43:58 -0400 Subject: [PATCH 42/43] remove word(s) from custom or extra censor list --- tests/test_profanity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index 6683ea8..abdcf54 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -53,7 +53,7 @@ def test_remove_word(self): pf.append_words(["oranges", "potato"]) update_censored() pf.remove_word("turd") - self.assertRaises(ValueError, pf.remove_word("potato", anywhere=False)) + self.assertRaises(ValueError, pf.remove_word, "potato", anywhere=False) pf.remove_word("oranges") update_censored() self.assertTrue("Turd" in censored) @@ -64,7 +64,7 @@ def test_remove_words(self): pf.define_words(["chocolate", "centaur"]) pf.append_words(["potato", "racecar", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) - self.assertRaises(ValueError, pf.remove_words(["chocolate", "racecar"], anywhere=False)) + self.assertRaises(ValueError, pf.remove_words, ["chocolate", "racecar"], anywhere=False) pf.remove_words(["centaur", "hey"]) self.assertTrue("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) From 1c1c1dbc0e895b85ee1e685ab5ef8b4c37c5db00 Mon Sep 17 00:00:00 2001 From: RicoViking9000 <38385704+RicoViking9000@users.noreply.github.com> Date: Thu, 14 Mar 2019 21:53:03 -0400 Subject: [PATCH 43/43] remove word(s) from custom or extra censor list Following programming logic and the way the remove words method was coded, the program would remove words individually, and would stop at the point it encountered the error, not before. Fixed incorrect assertion test due to this --- tests/test_profanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_profanity.py b/tests/test_profanity.py index abdcf54..6929f3d 100644 --- a/tests/test_profanity.py +++ b/tests/test_profanity.py @@ -66,7 +66,7 @@ def test_remove_words(self): self.assertTrue("chocolate" in pf.get_profane_words()) self.assertRaises(ValueError, pf.remove_words, ["chocolate", "racecar"], anywhere=False) pf.remove_words(["centaur", "hey"]) - self.assertTrue("chocolate" in pf.get_profane_words()) + self.assertFalse("chocolate" in pf.get_profane_words()) self.assertTrue("racecar" in pf.get_profane_words()) self.assertFalse("centaur" in pf.get_profane_words())