# Path: apiritif/utilities.py
# def random_uniform(start, stop=None):
# def random_gauss(sigma, mu):
# def random_string(size, chars=string.printable):
#     def __init__(self, format):
#     def _replacer(match):
#     def format_datetime(self, datetime):
# def format_date(format_string=None, datetime_obj=None):
# def base64_decode(encoded):
# def base64_encode(plaintext):
# def encode_url(chars):
# def uuid():
# class SimpleDateFormat(object):


import unittest
import re
from datetime import datetime
from apiritif import utilities
    def test_random_string(self):
        for _ in range(1000):
            random_str = utilities.random_string(10)
            self.assertEqual(10, len(random_str))
            self.assertIsInstance(random_str, str)

    def test_random_string_chars(self):
        hex_chars = "0123456789abcdef"
        for _ in range(1000):
            random_hex = utilities.random_string(5, chars=hex_chars)
            for char in random_hex:
                self.assertIn(char, random_hex)

    def test_format_date(self):
        timestamp = datetime(2010, 12, 19, 20, 5, 30)
        formatted = utilities.format_date("dd/MM/yyyy HH:mm:ss", timestamp)
        self.assertEqual("19/12/2010 20:05:30", formatted)

    def test_format_date_epoch(self):
        timestamp = datetime.fromtimestamp(1292789130)
        formatted = utilities.format_date(datetime_obj=timestamp)
        self.assertEqual("1292789130000", formatted)

    def test_base64_encode(self):
        self.assertEqual(utilities.base64_encode('foobar'), 'Zm9vYmFy')

    def test_base64_decode(self):
        self.assertEqual(utilities.base64_decode('Zm9vYmFy'), 'foobar')

    def test_encode_url(self):

# Path: apiritif/utilities.py
# def random_uniform(start, stop=None):
# def random_gauss(sigma, mu):
# def random_string(size, chars=string.printable):
#     def __init__(self, format):
#     def _replacer(match):
#     def format_datetime(self, datetime):
# def format_date(format_string=None, datetime_obj=None):
# def base64_decode(encoded):
# def base64_encode(plaintext):
# def encode_url(chars):
# def uuid():
# class SimpleDateFormat(object):


# Path: tests/unit/test_utilities.py
import unittest
import re
from datetime import datetime
from apiritif import utilities

    def test_random_string(self):
        for _ in range(1000):
            random_str = utilities.random_string(10)
            self.assertEqual(10, len(random_str))
            self.assertIsInstance(random_str, str)

    def test_random_string_chars(self):
        hex_chars = "0123456789abcdef"
        for _ in range(1000):
            random_hex = utilities.random_string(5, chars=hex_chars)
            for char in random_hex:
                self.assertIn(char, random_hex)

    def test_format_date(self):
        timestamp = datetime(2010, 12, 19, 20, 5, 30)
        formatted = utilities.format_date("dd/MM/yyyy HH:mm:ss", timestamp)
        self.assertEqual("19/12/2010 20:05:30", formatted)

    def test_format_date_epoch(self):
        timestamp = datetime.fromtimestamp(1292789130)
        formatted = utilities.format_date(datetime_obj=timestamp)
        self.assertEqual("1292789130000", formatted)

    def test_base64_encode(self):
        self.assertEqual(utilities.base64_encode('foobar'), 'Zm9vYmFy')

    def test_base64_decode(self):
        self.assertEqual(utilities.base64_decode('Zm9vYmFy'), 'foobar')

    def test_encode_url(self):

        self.assertEqual(utilities.encode_url('Foo Bar'), 'Foo+Bar')