Commit | Line | Data |
e1a479c5 |
1 | #!./perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | BEGIN { |
6 | unless (-d 'blib') { |
7 | chdir 't' if -d 't'; |
8 | @INC = '../lib'; |
9 | } |
10 | } |
11 | |
12 | use Test::More tests => 1; |
13 | |
14 | =pod |
15 | |
16 | This example is take from: http://www.python.org/2.3/mro.html |
17 | |
18 | "Serious order disagreement" # From Guido |
19 | class O: pass |
20 | class X(O): pass |
21 | class Y(O): pass |
22 | class A(X,Y): pass |
23 | class B(Y,X): pass |
24 | try: |
25 | class Z(A,B): pass #creates Z(A,B) in Python 2.2 |
26 | except TypeError: |
27 | pass # Z(A,B) cannot be created in Python 2.3 |
28 | |
29 | =cut |
30 | |
31 | { |
32 | package X; |
33 | |
34 | package Y; |
35 | |
36 | package XY; |
37 | our @ISA = ('X', 'Y'); |
38 | |
39 | package YX; |
40 | our @ISA = ('Y', 'X'); |
41 | |
42 | package Z; |
43 | our @ISA = ('XY', 'YX'); |
44 | } |
45 | |
46 | eval { mro::get_linear_isa('Z', 'c3') }; |
47 | like($@, qr/^Inconsistent /, '... got the right error with an inconsistent hierarchy'); |