Skip to content

Commit

Permalink
Merge pull request #1095 from stevenhua0320/lint-check-17
Browse files Browse the repository at this point in the history
Fix E501 E266 E712 F821 in test_validate, test_validators, runcontrol, test_commands.py
  • Loading branch information
sbillinge authored Jul 8, 2024
2 parents 35eafda + 57c6a17 commit 5d9308b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions regolith/runcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _validate(self, key, value):
def flatten(iterable):
"""Generator which returns flattened version of nested sequences."""
for el in iterable:
if isinstance(el, basestring):
if isinstance(el, str):
yield el
elif isinstance(el, Iterable):
for subel in flatten(el):
Expand All @@ -220,7 +220,7 @@ def flatten(iterable):
def ishashable(x):
"""Tests if a value is hashable."""
if isinstance(x, Hashable):
if isinstance(x, basestring):
if isinstance(x, str):
return True
elif isinstance(x, Iterable):
return all(map(ishashable, x))
Expand Down
8 changes: 4 additions & 4 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def test_mongo_to_fs_python(make_mongo_to_fs_backup_db, make_mongodb):
main(["mongo-to-fs"])
except Exception as e:
print(e)
assert True == False
assert False
else:
assert True == True
assert True
replace_rc_dbs(repo)
os.chdir(repo)
rc = copy.copy(DEFAULT_RC)
Expand All @@ -66,9 +66,9 @@ def test_fs_to_mongo_python(make_fs_to_mongo_migration_db, make_mongodb):
main(["fs-to-mongo"])
except Exception as e:
print(e)
assert True == False
assert False
else:
assert True == True
assert True
replace_rc_dbs(repo)
os.chdir(repo)
rc = copy.copy(DEFAULT_RC)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def test_validate_python_single_col(make_db):
"""
repo = make_db
os.chdir(repo)
## to see what is failing, comment out the rows that capture and restore the
## sys.stdout.
#to see what is failing, comment out the rows that capture and restore the
# sys.stdout.
backup = sys.stdout
sys.stdout = StringIO()
main(["validate", "--collection", "projecta"])
Expand Down
3 changes: 2 additions & 1 deletion tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ def test_mongo_invalid_insertion(make_mongodb):
rc.client.insert_one(only_database_in_test, "projecta", BAD_PROJECTUM)
except ValueError as e:
result = e.args[0]
expected = "ERROR in sb_firstprojectum:\n{'lead': ['required field'], 'status': ['required field']}\nNone\nNone\n---------------\n"
expected = ("ERROR in sb_firstprojectum:\n{'lead': ['required field'], 'status': ['required field']}"
"\nNone\nNone\n---------------\n")
assert result == expected

0 comments on commit 5d9308b

Please sign in to comment.