def test_adjust_sell_amount_without_enable(self): follower = XueQiuFollower() mock_user = mock.MagicMock() follower._users = [mock_user] follower._adjust_sell = False amount = follower._adjust_sell_amount("169101", 1000) self.assertEqual(amount, amount)
def test_adjust_sell_amount(self): follower = XueQiuFollower() mock_user = mock.MagicMock() follower._users = [mock_user] mock_user.position = TEST_POSITION follower._adjust_sell = True test_cases = [ ("169101", 600, 600), ("169101", 700, 600), ("000000", 100, 100), ("sh169101", 700, 600), ] for stock_code, sell_amount, excepted_amount in test_cases: amount = follower._adjust_sell_amount(stock_code, sell_amount) self.assertEqual(amount, excepted_amount)