Skip to content

Fixes to the validation script #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RuiLiGitLove
Copy link

Trying to create a pull request.

Copy link
Contributor

@matthew-brett matthew-brett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good - but - check your last function - see comments.

Comment on lines +35 to +36
hash_value = sha1(contents).hexdigest()
return hash_value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or:

Suggested change
hash_value = sha1(contents).hexdigest()
return hash_value
return sha1(contents).hexdigest()

# Split each line into expected_hash and filename
[exp_hash, gap, filename] = line.split(sep=' ')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - but you don't even need the brackets around the list on the left hand side. And you can use the default separator (of any number of spaces) to make it a bit simpler, as in:

Suggested change
[exp_hash, gap, filename] = line.split(sep=' ')
exp_hash, filename = line.split()

Comment on lines -57 to +66
return False
result = (act_hash == exp_hash)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that you end up returning the result of the last test here, so if any of the previous tests failed, the function still returns True. I think you want something like:

        result = result and (act_hash == exp_hash)

to combine the results of the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants