File: test_nestedclass.py

package info (click to toggle)
elixir 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 640 kB
  • ctags: 1,079
  • sloc: python: 4,936; makefile: 10
file content (32 lines) | stat: -rw-r--r-- 980 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from elixir import *

def setup():
    global Thing

    class Thing(Entity):
        name = Field(String(40))
        type = Field(String(40))

        class Stuff(Entity):
            ping = Field(String(32))
            pong = Field(String(32))

        other = Field(String(40))

    setup_all()

class TestNestedClass(object):
    def test_nestedclass(self):

        print "GLOBALS", globals().keys()
        assert 'name' in Thing.table.columns.keys()
        assert 'type' in Thing.table.columns.keys()
        assert 'other' in Thing.table.columns.keys()
        assert 'ping' not in Thing.table.columns.keys()
        assert 'pong' not in Thing.table.columns.keys()

        assert 'name' not in Thing.Stuff.table.columns.keys()
        assert 'type' not in Thing.Stuff.table.columns.keys()
        assert 'other' not in Thing.Stuff.table.columns.keys()
        assert 'ping' in Thing.Stuff.table.columns.keys()
        assert 'pong' in Thing.Stuff.table.columns.keys()