File: test_app.py

package info (click to toggle)
python-bottle 0.13.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,540 kB
  • sloc: python: 6,417; makefile: 70; sh: 30
file content (20 lines) | stat: -rw-r--r-- 536 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8 -*-
""" Tests for the functionality of the application object.

    TODO: Move other tests here.
""" 

import unittest
from bottle import Bottle

class TestApplicationObject(unittest.TestCase):
    
    def test_setattr(self):
        """ Attributed can be assigned, but only once. """
        app = Bottle()
        app.test = 5
        self.assertEqual(5, app.test)
        self.assertRaises(AttributeError, setattr, app, 'test', 6) 
        del app.test
        app.test = 6
        self.assertEqual(6, app.test)