micropython

Annotated tests/failure/importer.py

290:029ccbe64c2b
2009-11-28 Paul Boddie Added another reference.
paul@94 1
#!/usr/bin/env python
paul@94 2
paul@94 3
import imported
paul@94 4
paul@94 5
imported.attr = 456 # detected with warning
paul@94 6
paul@94 7
m = imported
paul@94 8
imported.a = 9      # detected with warning
paul@94 9
m.a = 8             # detected with warning (m is always imported)
paul@94 10
paul@94 11
imported.x = 1      # detected with warning (despite no collision)
paul@94 12
paul@108 13
class C:            # hack: make an attribute called y known to the system
paul@108 14
    y = None        # hack: this prevents compilation errors with the statements
paul@108 15
                    # hack: below
paul@108 16
paul@94 17
n = None
paul@94 18
n = imported
paul@94 19
n.y = 2             # not detected due to reassignment of n
paul@94 20
n.y = 3             # not detected due to reassignment of n
paul@94 21
paul@94 22
# vim: tabstop=4 expandtab shiftwidth=4