MCPcopy Create free account
hub / github.com/KLayout/klayout / test_issue1549

Method test_issue1549

testdata/python/dbLayoutTest.py:1233–1260  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1231
1232 # Properties IDs
1233 def test_issue1549(self):
1234
1235 ly = pya.Layout.new()
1236
1237 ps1 = { 1: "one", "key": 17 }
1238 ps2 = [ ( 2, "two" ), ( "key", 42 ) ]
1239
1240 pid1 = pya.Layout.properties_id(ps1)
1241 # deprecated, for backward compatibility:
1242 self.assertEqual(ly.properties_array(pid1), [[1, 'one'], ['key', 17]])
1243 self.assertEqual(ly.properties_hash(pid1), {1: 'one', 'key': 17})
1244 self.assertEqual(pid1, ly.properties_id(ps1))
1245 # static method versions
1246 self.assertEqual(pya.Layout.properties_array(pid1), [[1, 'one'], ['key', 17]])
1247 self.assertEqual(pya.Layout.properties_hash(pid1), {1: 'one', 'key': 17})
1248 self.assertEqual(pya.Layout.property(pid1, 42).__repr__(), "None")
1249 self.assertEqual(pya.Layout.property(pid1, 1).__repr__(), "'one'")
1250
1251 pid2 = pya.Layout.properties_id(ps2)
1252 # deprecated, for backward compatibility:
1253 self.assertEqual(pid2, ly.properties_id(ps2))
1254 self.assertEqual(ly.properties_array(pid2), [[2, 'two'], ['key', 42]])
1255 self.assertEqual(ly.properties_hash(pid2), {2: 'two', 'key': 42})
1256 # static method versions
1257 self.assertEqual(pya.Layout.properties_array(pid2), [[2, 'two'], ['key', 42]])
1258 self.assertEqual(pya.Layout.properties_hash(pid2), {2: 'two', 'key': 42})
1259 self.assertEqual(pya.Layout.property(pid2, 42).__repr__(), "None")
1260 self.assertEqual(pya.Layout.property(pid2, 2).__repr__(), "'two'")
1261
1262# run unit tests
1263if __name__ == '__main__':

Callers

nothing calls this directly

Calls 3

__repr__Method · 0.80
properties_idMethod · 0.45
propertyMethod · 0.45

Tested by

no test coverage detected