<commit_before>import numpy
import unittest
import warnings
import timeit
import zerosum.balance

strategy_count = 32
    
class TestWeights(unittest.TestCase):
    def test_zero_weight_sum_error(self):
        weights = numpy.zeros((strategy_count,))
        with self.assertRaisesRegex(ValueError, 'sum to 0'):
            zerosum.balance.base._process_weights(weights)
    
    def test_negative_weight_error(self):
        weights = -numpy.ones((strategy_count,))
        with self.assertRaisesRegex(ValueError, 'negative'):
            zerosum.balance.base._process_weights(weights)

class TestNonSymmetricBalance(unittest.TestCase):
    def test_fix_index_zero_weight_error(self):
        with self.assertWarnsRegex(zerosum.balance.ValueWarning, 'zero weight'):
            strategy_weights = numpy.array([0.0, 1.0])
            zerosum.balance.base.NonSymmetricBalance(row_weights = strategy_weights, col_weights = strategy_weights, fix_index = 0)

class TestSymmetricBalance(unittest.TestCase):

    def test_fix_index_zero_weight_error(self):
        with self.assertWarnsRegex(zerosum.balance.ValueWarning, 'zero weight'):
            strategy_weights = numpy.array([0.0, 1.0])
            zerosum.balance.base.SymmetricBalance(strategy_weights = strategy_weights, fix_index = 0)

<commit_msg>add todo for input checking tests<commit_after>import numpy
import unittest
import warnings
import timeit
import zerosum.balance

strategy_count = 32
    
class TestWeights(unittest.TestCase):
    def test_zero_weight_sum_error(self):
        weights = numpy.zeros((strategy_count,))
        with self.assertRaisesRegex(ValueError, 'sum to 0'):
            zerosum.balance.base._process_weights(weights)
    
    def test_negative_weight_error(self):
        weights = -numpy.ones((strategy_count,))
        with self.assertRaisesRegex(ValueError, 'negative'):
            zerosum.balance.base._process_weights(weights)

class TestNonSymmetricBalance(unittest.TestCase):
    def test_fix_index_zero_weight_error(self):
        with self.assertWarnsRegex(zerosum.balance.ValueWarning, 'zero weight'):
            strategy_weights = numpy.array([0.0, 1.0])
            zerosum.balance.base.NonSymmetricBalance(row_weights = strategy_weights, col_weights = strategy_weights, fix_index = 0)

class TestSymmetricBalance(unittest.TestCase):

    def test_fix_index_zero_weight_error(self):
        with self.assertWarnsRegex(zerosum.balance.ValueWarning, 'zero weight'):
            strategy_weights = numpy.array([0.0, 1.0])
            zerosum.balance.base.SymmetricBalance(strategy_weights = strategy_weights, fix_index = 0)

# TODO: add input checking tests
{'fraction_non_alphanumeric': 0.09255079006772009, 'fraction_numerical': 0.009781790820165538, 'mean_word_length': 4.045540796963947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '648869', 'n_tokens_mistral': 803, 'n_tokens_neox': 800, 'n_words': 138}