fix flake8

This commit is contained in:
Scott Sadler 2017-01-18 17:13:38 +01:00
parent ae14d0e5c4
commit 2ec23be05d
5 changed files with 10 additions and 9 deletions

View File

@ -17,7 +17,7 @@ def valid_bool(val):
def valid_ed25519(key):
if (re.match('^[1-9a-zA-Z]{43,44}$', key) and not
re.match('.*[Il0O]', key)):
re.match('.*[Il0O]', key)):
return key
raise ValueError("Invalid base58 ed25519 key")

View File

@ -5,7 +5,6 @@ For more information please refer to the documentation on ReadTheDocs:
http-client-server-api.html
"""
import logging
import re
from flask import current_app, request
from flask_restful import Resource, reqparse

View File

@ -28,9 +28,8 @@ def txlist(b, user_pk, user2_pk, user_sk, user2_sk, genesis_block):
b.write_block(block2)
# Create block with double spend
tx_doublespend = Transaction.transfer(create1.to_inputs(),
[([user_pk], 9)],
create1.id).sign([user2_sk])
tx_doublespend = Transaction.transfer(create1.to_inputs(), [([user_pk], 9)],
create1.id).sign([user2_sk])
block_doublespend = b.create_block([tx_doublespend])
b.write_block(block_doublespend)
@ -43,7 +42,7 @@ def txlist(b, user_pk, user2_pk, user_sk, user2_sk, genesis_block):
# Create undecided block
untx = Transaction.create([user_pk], [([user2_pk], 7)]) \
.sign([user_sk])
.sign([user_sk])
block_undecided = b.create_block([untx])
b.write_block(block_undecided)

View File

@ -22,8 +22,8 @@ def test_valid_txid():
def test_valid_bool():
from bigchaindb.web.views.parameters import valid_bool
assert valid_bool('true') == True
valid_bool('false') == False
assert valid_bool('true') is True
assert valid_bool('false') is False
with pytest.raises(ValueError):
valid_bool('TRUE')

View File

@ -1,6 +1,6 @@
import builtins
import json
from unittest.mock import Mock, patch
from unittest.mock import patch
import pytest
from bigchaindb.common import crypto
@ -185,6 +185,7 @@ def test_post_invalid_transfer_transaction_returns_400(b, client, user_pk):
def test_transactions_get_list_good(client):
from functools import partial
def gtf(conn, **args):
return [type('', (), {'to_dict': partial(lambda a: a, arg)})
for arg in sorted(args.items())]
@ -205,6 +206,8 @@ def test_transactions_get_list_good(client):
def test_transactions_get_list_bad(client):
def should_not_be_called():
assert False
with patch('bigchaindb.core.Bigchain.get_transactions_filtered',
lambda *_, **__: should_not_be_called()):
# Test asset id validated