diff --git a/.travis.yml b/.travis.yml index 88629ca6856060fbd4e0f97bd6f6762ad1fc0538..2bad890a7df5393622b9cea4a8cc16d1643afdd5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,7 @@ matrix: - os: linux python: 3.6 env: - - PYFLAKES=1 - - PEP8=1 - before_install: - - pip install pep8==1.6.2 - - pip install flake8 - script: - - flake8 + - TOXENV=pylint - os: linux python: 2.7 env: diff --git a/beem/block.py b/beem/block.py index 14c0db42fc86001860677992a5508cd2c9b236de..02c6519992b0b2d4afb0c04102696f2bf84ba39d 100644 --- a/beem/block.py +++ b/beem/block.py @@ -45,10 +45,6 @@ class Block(BlockchainObject): """ return parse_time(self['timestamp']) - def change_block_number(self, number): - self.identifier = number - self.refresh() - def ops(self): ops = [] for tx in self["transactions"]: diff --git a/beem/steem.py b/beem/steem.py index 18a90dd818616b759223ee3737d2df5615a73ab5..1c3ad1d4123141483adf39bd5ef1fea870717d3a 100644 --- a/beem/steem.py +++ b/beem/steem.py @@ -454,7 +454,8 @@ class Steem(object): # Append to the append_to and return append_to = kwargs["append_to"] parent = append_to.get_parent() - assert isinstance(append_to, (TransactionBuilder)) + if not isinstance(append_to, (TransactionBuilder)): + raise AssertionError() append_to.appendOps(ops) # Add the signer to the buffer so we sign the tx properly parent.appendSigner(account, permission) @@ -677,7 +678,8 @@ class Steem(object): delegation_fee_steem = Amount(delegation_fee_steem, steem_instance=self) else: delegation_fee_steem = Amount(delegation_fee_steem, "STEEM", steem_instance=self) - assert delegation_fee_steem["symbol"] == "STEEM" + if not delegation_fee_steem["symbol"] == "STEEM": + raise AssertionError() " Generate new keys from password" from beembase.account import PasswordKey diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index 5f2e41be11a6c0a2568bb19540cb9939cd0901e8..0000000000000000000000000000000000000000 --- a/requirements-test.txt +++ /dev/null @@ -1,16 +0,0 @@ -future -pycryptodomex>=3.4.6 -ecdsa -requests -websocket-client -pytz -scrypt>=0.8.0 -Events>=0.2.2 -pyyaml -pytest -pytest-mock -coverage -mock -appdirs -Click -prettytable diff --git a/tests/test_block.py b/tests/test_block.py index 038c7b59e6d6e622f63f1a4f3e34d00198e31087..19aa9f3ea96e8d650654ca94ea4e2e8c6864f3f9 100644 --- a/tests/test_block.py +++ b/tests/test_block.py @@ -39,8 +39,6 @@ class Testcases(unittest.TestCase): block2 = Block(2, steem_instance=bts) self.assertTrue(block2.time() > block.time()) - block2.change_block_number(3) - self.assertEqual(block2.identifier, 3) def test_block_ops(self): bts = self.bts diff --git a/tests/test_discussions.py b/tests/test_discussions.py new file mode 100644 index 0000000000000000000000000000000000000000..8fc065105bcce190e34b140a0d3d9c2cd3224c80 --- /dev/null +++ b/tests/test_discussions.py @@ -0,0 +1,39 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals +from builtins import super +import unittest +from pprint import pprint +from beem import Steem +from beem.discussions import Query, Discussions_by_trending +from datetime import datetime +from beem.instance import set_shared_steem_instance + +wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" +nodes = ["wss://steemd.pevo.science", "wss://gtg.steem.house:8090", "wss://rpc.steemliberator.com", "wss://rpc.buildteam.io", + "wss://rpc.steemviz.com", "wss://seed.bitcoiner.me", "wss://node.steem.ws", "wss://steemd.steemgigs.org", "wss://steemd.steemit.com", + "wss://steemd.minnowsupportproject.org"] + + +class Testcases(unittest.TestCase): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + self.bts = Steem( + node=nodes, + nobroadcast=True, + keys={"active": wif}, + ) + # from getpass import getpass + # self.bts.wallet.unlock(getpass()) + set_shared_steem_instance(self.bts) + self.bts.set_default_account("test") + + def test_trending(self): + bts = self.bts + query = Query() + query["limit"] = 10 + d = Discussions_by_trending(query, steem_instance=bts) + self.assertEqual(len(d), 10) diff --git a/tox.ini b/tox.ini index 5d7a2d640aa3e03721d64a0fe61fe7316e578bf6..7ce302ad5c5559f8a0903de2e3c08c6f7655fa71 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,7 @@ skip_missing_interpreters = true deps = mock>=2.0.0 pytest + pytest-mock coverage commands = coverage run --parallel-mode -m pytest {posargs}