<commit_before>"""Tests for utils module - wkt_rewind"""
from nose.tools import *
import unittest
import re
from pygbif import utils

x = 'POLYGON((144.6 13.2, 144.6 13.6, 144.9 13.6, 144.9 13.2, 144.6 13.2))'

def test_wkt_rewind():
    "utils.wkt_rewind - basic test"
    res = utils.wkt_rewind(x)
    assert str == res.__class__

class TestWKTClass(unittest.TestCase):
    def test_wkt_rewind_digits(self):
        "utils.wkt_rewind - digits works as expected"
        res = utils.wkt_rewind(x, digits = 3)
        pat = re.compile('\\.[0-9]{3}\\s')
        out = pat.search(res)
        self.assertIsInstance(out, re.Match)

@raises(TypeError)
def test_wkt_rewind_fails_well():
    "utils.wkt_rewind - fails well"
    utils.wkt_rewind(x, digits = "foo")<commit_msg>fix test<commit_after>"""Tests for utils module - wkt_rewind"""
from nose.tools import *
import unittest
import re
from pygbif import utils

x = 'POLYGON((144.6 13.2, 144.6 13.6, 144.9 13.6, 144.9 13.2, 144.6 13.2))'

def test_wkt_rewind():
    "utils.wkt_rewind - basic test"
    res = utils.wkt_rewind(x)
    assert str == res.__class__

class TestWKTClass(unittest.TestCase):
    def test_wkt_rewind_digits(self):
        "utils.wkt_rewind - digits works as expected"
        res = utils.wkt_rewind(x, digits = 3)
        pat = re.compile('\\.[0-9]{3}\\s')
        out = pat.search(res)
        self.assertIsInstance(out.string, str)

@raises(TypeError)
def test_wkt_rewind_fails_well():
    "utils.wkt_rewind - fails well"
    utils.wkt_rewind(x, digits = "foo")
{'fraction_non_alphanumeric': 0.13811074918566776, 'fraction_numerical': 0.050814332247557006, 'mean_word_length': 3.2905027932960893, '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': '7023432', 'n_tokens_mistral': 650, 'n_tokens_neox': 599, 'n_words': 130}