Beispiel #1
0
 def test_sequences(self):
     self.assertEqual('2, 3', humanize([2, 3]))
     self.assertEqual('2, foo, 1.2', humanize([2, 'foo', 1.2]))
     self.assertEqual([None, None], humanize([None, None]))
     self.assertEqual([4, {1: 1}], humanize([4, {1: 1}]))
Beispiel #2
0
    def test_keywords(self):
        self.assertEqual('SSL', humanize('ssl'))
        self.assertEqual('SSL', humanize('SSL'))

        self.assertEqual('URI', humanize('uri'))
        self.assertEqual('URI', humanize('URI'))

        self.assertEqual('UUID', humanize('uuid'))
        self.assertEqual('UUID', humanize('UUID'))

        self.assertEqual('ETA', humanize('eta'))
        self.assertEqual('ETA', humanize('ETA'))

        self.assertEqual('URL', humanize('url'))
        self.assertEqual('URL', humanize('URL'))

        self.assertEqual('args', humanize('args'))
        self.assertEqual('kwargs', humanize('kwargs'))
Beispiel #3
0
 def test_uuid(self):
     uuid = '5cf83762-9507-4dc5-8e5a-ad730379b099'
     self.assertEqual(uuid, humanize(uuid))
Beispiel #4
0
 def test_time(self):
     self.assertEqual(1343911558.305793, humanize(1343911558.305793))
     self.assertEqual('2012-08-02 16:45:58',
                      humanize(1343911558.305793, type='time'))
Beispiel #5
0
 def test_numbers(self):
     self.assertEqual(0, humanize(0))
     self.assertEqual(3, humanize(3))
     self.assertEqual(0.2, humanize(0.2))
Beispiel #6
0
 def test_strings(self):
     self.assertEqual('Max tasks per child',
                      humanize('max_tasks_per_child'))
     self.assertEqual('URI prefix', humanize('uri_prefix'))
     self.assertEqual('Max concurrency', humanize('max-concurrency'))
Beispiel #7
0
def format_task(task):
    task.args = humanize(task.args, length=50)
    return task
Beispiel #8
0
 def test_time(self):
     self.assertEqual(1343911558.305793, humanize(1343911558.305793))
     self.assertEqual(format_time(1343911558.305793),
                      humanize(1343911558.305793, type='time'))
Beispiel #9
0
 def test_strings(self):
     self.assertEqual('Max tasks per child',
                      humanize('max_tasks_per_child'))
     self.assertEqual('URI prefix', humanize('uri_prefix'))
     self.assertEqual('Max concurrency', humanize('max-concurrency'))
Beispiel #10
0
 def test_uuid(self):
     uuid = '5cf83762-9507-4dc5-8e5a-ad730379b099'
     self.assertEqual(uuid, humanize(uuid))
Beispiel #11
0
 def test_sequences(self):
     self.assertEqual('2, 3', humanize([2, 3]))
     self.assertEqual('2, foo, 1.2', humanize([2, 'foo', 1.2]))
     self.assertEqual([None, None], humanize([None, None]))
     self.assertEqual([4, {1: 1}], humanize([4, {1: 1}]))
Beispiel #12
0
    def test_keywords(self):
        self.assertEqual('SSL', humanize('ssl'))
        self.assertEqual('SSL', humanize('SSL'))

        self.assertEqual('URI', humanize('uri'))
        self.assertEqual('URI', humanize('URI'))

        self.assertEqual('UUID', humanize('uuid'))
        self.assertEqual('UUID', humanize('UUID'))

        self.assertEqual('ETA', humanize('eta'))
        self.assertEqual('ETA', humanize('ETA'))

        self.assertEqual('URL', humanize('url'))
        self.assertEqual('URL', humanize('URL'))

        self.assertEqual('args', humanize('args'))
        self.assertEqual('kwargs', humanize('kwargs'))
Beispiel #13
0
 def test_numbers(self):
     self.assertEqual(0, humanize(0))
     self.assertEqual(3, humanize(3))
     self.assertEqual(0.2, humanize(0.2))
Beispiel #14
0
def format_task(task):
    task.args = humanize(task.args, length=100)
    #task.kwargs.pop('credit_card_number')
    task.result = humanize(task.result, length=100)
    return task
Beispiel #15
0
 def test_time(self):
     self.assertEqual(1343911558.305793, humanize(1343911558.305793))
     self.assertEqual(format_time(1343911558.305793),
                      humanize(1343911558.305793, type='time'))
Beispiel #16
0
 def test_None(self):
     self.assertEqual('', humanize(None))
Beispiel #17
0
 def test_monotonic_time(self):
     self.assertEqual(humanize(time(), "time"), humanize_monotonic_time(monotonic()))
Beispiel #18
0
 def test_bool(self):
     self.assertEqual(True, humanize(True))
     self.assertEqual(False, humanize(False))
Beispiel #19
0
 def test_None(self):
     self.assertEqual('', humanize(None))
Beispiel #20
0
 def test_bool(self):
     self.assertEqual(True, humanize(True))
     self.assertEqual(False, humanize(False))
def format_task(task):
    task.args = humanize(task.args, length=500)
    task.kwargs = humanize(task.kwargs, length=500)
    task.result = humanize(task.result, length=500)
    return task
Beispiel #22
0
 def test_time(self):
     from pytz import utc
     self.assertEqual(1343911558.305793, humanize(1343911558.305793))
     self.assertEqual(format_time(1343911558.305793, utc),
                      humanize(1343911558.305793, type='time'))