Exemplo n.º 1
0
    def test_date_handling(self):
        dt = datetime.datetime(2010, 1, 1, 1, 1, 1)
        c1 = Complex(
            title='complex example',
            pub_date=dt)
        c1.save()

        self.assertEqual(c1.slug, 'complex')

        dt = datetime.datetime(2010, 1, 2, 1, 1, 1)
        c2 = Complex(
            title='complex example',
            pub_date=dt)
        c2.save()

        self.assertEqual(c2.slug, 'complex')

        c3 = Complex(
            title='complex example',
            pub_date=dt)
        c3.save()
        
        self.assertEqual(c3.slug, 'complex_')
Exemplo n.º 2
0
    def test_complex_splitting(self):
        dt = datetime.datetime(2010, 1, 1, 1, 1, 1)
        c1 = Complex(title='complex example test', pub_date=dt)
        c1.save()

        self.assertEqual(c1.slug, 'complex')

        c1.title = "complex as hell"
        c1.save()
        self.assertEqual(c1.slug, 'complex-as')

        c2 = Complex(title='complex as hell', pub_date=dt)
        c2.save()
        self.assertEqual(c2.slug, 'complex-a_')

        c3 = Complex(title='complex as hell', pub_date=dt)
        c3.save()
        self.assertEqual(c3.slug, 'complex-__')
Exemplo n.º 3
0
    def test_split_words_generation(self):
        dt = datetime.datetime(2010, 1, 1, 1, 1, 1)
        c1 = Complex(title='complex example', pub_date=dt)
        c1.save()
        self.assertEqual(c1.slug, 'complex')

        c2 = Complex(title='complex example', pub_date=dt)
        c2.save()
        self.assertEqual(c2.slug, 'complex_')

        c3 = Complex(title='complex example', pub_date=dt)
        c3.save()
        self.assertEqual(c3.slug, 'complex__')
        
        c4 = Complex(title='complex example', pub_date=dt)
        c4.save()
        self.assertEqual(c4.slug, 'complex___')
        
        c5 = Complex(title='complex example', pub_date=dt)
        c5.save()
        self.assertEqual(c5.slug, 'comple____')