<commit_before># -*- coding: utf-8 -*-
# Copyright © 2013 <NAME>, <NAME>

import unittest 
from Position import Position

class PositionTest(unittest.TestCase):

    def test_construct(self): 
        b = Position(3, 4)

        self.assertEqual(b.x, 3)
        self.assertEqual(b.y, 4)

    def test_construct_error(self): 
        with self.assertRaises(ValueError):
            b = Position(0, 4)

    def test_construct_from_string(self):
        b = Position.from_string("b6")

        self.assertEqual(b.x, 2)
        self.assertEqual(b.y, 6)

    def test_construct_from_string_error(self):
        with self.assertRaises(ValueError):
            b = Position.from_string("a7")

        with self.assertRaises(ValueError):
            b = Position.from_string("z4")

    def test_to_str(self):
        b = Position.from_string("a4")
        self.assertEqual(str(b), "a4")

        b = Position(1, 4)
        self.assertEqual(str(b), "a4")


if __name__ == "__main__": 
    unittest.main()<commit_msg>unittests now test the string of the exception also<commit_after># -*- coding: utf-8 -*-
# Copyright © 2013 <NAME>, <NAME>

import unittest 
from Position import Position

class PositionTest(unittest.TestCase):

    def test_construct(self): 
        b = Position(3, 4)

        self.assertEqual(b.x, 3)
        self.assertEqual(b.y, 4)

    def test_construct_error(self): 
        with self.assertRaisesRegex(ValueError, "Wrong row/col index"):
            b = Position(0, 4)

    def test_construct_from_string(self):
        b = Position.from_string("b6")

        self.assertEqual(b.x, 2)
        self.assertEqual(b.y, 6)

    def test_construct_from_string_error(self):
        with self.assertRaisesRegex(ValueError, "Too much position information"):
            b = Position.from_string("z4a")

        with self.assertRaisesRegex(ValueError, "Wrong row index"):
            b = Position.from_string("a7")

        with self.assertRaisesRegex(ValueError, "Wrong column index"):
            b = Position.from_string("z4")

    def test_to_str(self):
        b = Position.from_string("a4")
        self.assertEqual(str(b), "a4")

        b = Position(1, 4)
        self.assertEqual(str(b), "a4")


if __name__ == "__main__": 
    unittest.main()
{'fraction_non_alphanumeric': 0.12533215234720993, 'fraction_numerical': 0.01904340124003543, 'mean_word_length': 2.69721767594108, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '4961116', 'n_tokens_mistral': 756, 'n_tokens_neox': 712, 'n_words': 154}