Skip to content

Commit 79033e7

Browse files
author
Abhilash Joseph C
committed
Update the Cyclomatic complexity
1 parent 14a9734 commit 79033e7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

py3resttest/generators.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,13 @@ def parse_random_text_generator(configuration):
161161
"Illegal character set name, is not defined: {0}".format(character_set))
162162
characters = CHARACTER_SETS[character_set]
163163
else: # Custom characters listing, not a character set
164-
characters = str(configuration.get('characters'))
164+
characters = configuration.get('characters')
165165

166166
min_length = int(configuration.get('min_length', 8))
167167
max_length = int(configuration.get('max_length', 8))
168168
if not characters:
169169
return factory_generate_text(min_length=min_length, max_length=max_length)()
170+
characters = str(characters)
170171

171172
if configuration.get('length'):
172173
length = int(configuration.get('length'))

tests/test_generators.py

+5
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ def test_parse_text_generator(self):
205205
"Should never parse an invalid character_set successfully, but did!")
206206
except ValueError:
207207
pass
208+
test_config = {'type': 'random_text'}
209+
try:
210+
gen = generators.parse_generator(test_config)
211+
except Exception:
212+
self.fail("Should never Raise an exception!")
208213

209214
# Test for character set handling
210215
for charset in generators.CHARACTER_SETS:

0 commit comments

Comments
 (0)