FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
circuitpython/tests/misc/non_compliant.py at main · ams1/circuitpython · GitHub
ams1
circuitpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
circuitpython
/
tests
/
misc
/
non_compliant.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
158 lines (123 loc) · 3.09 KB
Breadcrumbs
circuitpython
/
tests
/
misc
/
non_compliant.py
Copy path
File metadata and controls
158 lines (123 loc) · 3.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# tests for things that are not implemented, or have non-compliant behaviour
try
:
import
array
import
struct
except
ImportError
:
print
(
"SKIP"
)
raise
SystemExit
# when super can't find self
try
:
exec
(
"def f(): super()"
)
except
SyntaxError
:
print
(
"SyntaxError"
)
# store to exception attribute is not allowed
try
:
ValueError
().
x
=
0
except
AttributeError
:
print
(
"AttributeError"
)
# array deletion not implemented
try
:
a
=
array
.
array
(
"b"
, (
1
,
2
,
3
))
del
a
[
1
]
except
TypeError
:
print
(
"TypeError"
)
# slice with step!=1 not implemented
try
:
a
=
array
.
array
(
"b"
, (
1
,
2
,
3
))
print
(
a
[
3
:
2
:
2
])
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# containment, looking for integer not implemented
try
:
print
(
1
in
array
.
array
(
"B"
,
b"12"
))
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# uPy raises TypeError, should be ValueError
try
:
"%c"
%
b"
\x01
\x02
"
except
(
TypeError
,
ValueError
):
print
(
"TypeError, ValueError"
)
# attributes/subscr not implemented
try
:
print
(
"{a[0]}"
.
format
(
a
=
[
1
,
2
]))
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# str(...) with keywords not implemented
try
:
str
(
b"abc"
,
encoding
=
"utf8"
)
except
NotImplementedError
:
print
(
"TypeError"
)
# str.rsplit(None, n) not implemented
try
:
"a a a"
.
rsplit
(
None
,
1
)
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# str.endswith(s, start) not implemented
try
:
"abc"
.
endswith
(
"c"
,
1
)
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# str subscr with step!=1 not implemented
try
:
print
(
"abc"
[
1
:
2
:
3
])
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# bytes(...) with keywords not implemented
try
:
bytes
(
"abc"
,
encoding
=
"utf8"
)
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# bytes subscr with step!=1 not implemented
try
:
b"123"
[
0
:
3
:
2
]
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# tuple load with step!=1 not implemented
try
:
()[
2
:
3
:
4
]
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# list store with step!=1 not implemented
try
:
[][
2
:
3
:
4
]
=
[]
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# list delete with step!=1 not implemented
try
:
del
[][
2
:
3
:
4
]
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# array slice assignment with unsupported RHS
try
:
bytearray
(
4
)[
0
:
1
]
=
[
1
,
2
]
except
NotImplementedError
:
print
(
"NotImplementedError"
)
# can't assign attributes to a function
def
f
():
pass
try
:
f
.
x
=
1
except
AttributeError
:
print
(
"AttributeError"
)
# can't call a function type (ie make new instances of a function)
try
:
type
(
f
)()
except
TypeError
:
print
(
"TypeError"
)
# test when object explicitly listed at not-last position in parent tuple
# this is not compliant with CPython because of illegal MRO
class
A
:
def
foo
(
self
):
print
(
"A.foo"
)
class
B
(
object
,
A
):
pass
B
().
foo
()
# can't assign property (or other special accessors) to already-subclassed class
class
A
:
pass
class
B
(
A
):
pass
try
:
A
.
bar
=
property
()
except
AttributeError
:
print
(
"AttributeError"
)
Back
|
FazBrowse Home
|
New Git URL