コード例 #1
0
def main():
    cw = CoreWLAN()
    print('Wireless interfaces')
    pprint(cw.get_interface_names())
    # print(type(CWInterface.interfaceNames()))
    pprint([i for i in CWInterface.interfaceNames()])

    wl = WlanInterface()
    # dump(cw.iface)
    print('Properties:')
    pprint(objc.propertiesForClass(CWInterface))
    print('Current channel is: %s' % wl.get_channel())
コード例 #2
0
def main():
    cw = CoreWLAN()
    print('Wireless interfaces')
    pprint(cw.get_interface_names())
    # print(type(CWInterface.interfaceNames()))
    pprint([i for i in CWInterface.interfaceNames()])

    wl = WlanInterface()
    # dump(cw.iface)
    print('Properties:')
    pprint(objc.propertiesForClass(CWInterface))
    print('Current channel is: %s' % wl.get_channel())
コード例 #3
0
    def testBasic(self):
        props = objc.propertiesForClass(OCPropertyDefinitions)
        self.assertIsInstance(props, list)

        p = self.get_prop(props, "prop1")
        self.assertEqual(p["name"], "prop1")
        self.assertIsInstance(p["raw_attr"], bytes)
        self.assertEqual(p["typestr"], objc._C_INT)
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop2")
        self.assertEqual(p["name"], "prop2")
        self.assertEqual(p["typestr"], objc._C_FLT)
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop3")
        self.assertEqual(p["name"], "prop3")
        self.assertEqual(p["typestr"], b"{s=ic}")
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop4")
        self.assertEqual(p["name"], "prop4")
        self.assertEqual(p["typestr"], objc._C_ID)
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop5")
        self.assertEqual(p["name"], "prop5")
        self.assertEqual(p["typestr"], objc._C_ID)
        self.assertTrue(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop6")
        self.assertEqual(p["name"], "prop6")
        self.assertEqual(p["typestr"], objc._C_ID)
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop7")
        self.assertEqual(p["name"], "prop7")
        self.assertEqual(p["typestr"], objc._C_ID)
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop8")
        self.assertEqual(p["name"], "prop8")
        self.assertEqual(p["typestr"], objc._C_ID)
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertTrue(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop9")
        self.assertEqual(p["name"], "prop9")
        self.assertEqual(p["typestr"], objc._C_ID)
        self.assertFalse(p.get("readonly", False))
        self.assertTrue(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertFalse(p.get("dynamic", False))

        p = self.get_prop(props, "prop10")
        self.assertEqual(p["name"], "prop10")
        self.assertEqual(p["typestr"], b"{s=ic}")
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("dynamic", False))

        # This seems to be a bug in the objc runtime:
        # self.assertTrue(p.get('nonatomic', False))

        p = self.get_prop(props, "prop11")
        self.assertEqual(p["name"], "prop11")
        self.assertEqual(p["typestr"], objc._C_ID)
        self.assertFalse(p.get("readonly", False))
        self.assertFalse(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertFalse(p.get("nonatomic", False))
        self.assertEqual(p.get("setter"), b"propSetter:")
        self.assertEqual(p.get("getter"), b"propGetter")
        self.assertFalse(p.get("dynamic", False))

        # p = self.get_prop(props, "prop12")
        # self.assertEqual(p['name'], "prop12")
        # self.assertEqual(p['typestr'], objc._C_ID)
        # self.assertFalse(p.get('readonly', False))
        # self.assertFalse(p.get('copy', False))
        # self.assertTrue(p.get('retain', False))
        # self.assertTrue(p.get('nonatomic', False))
        # self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop13")
        self.assertEqual(p["name"], "prop13")
        self.assertEqual(p["typestr"], objc._C_ID)
        self.assertFalse(p.get("readonly", False))
        self.assertTrue(p.get("copy", False))
        self.assertFalse(p.get("retain", False))
        self.assertTrue(p.get("dynamic", False))
コード例 #4
0
    def testBasic(self):
        props = objc.propertiesForClass(OCPropertyDefinitions)
        self.assertIsInstance(props, list)

        p = self.get_prop(props, "prop1")
        self.assertEquals(p['name'], "prop1")
        self.assertIsInstance(p['raw_attr'], bytes)
        self.assertEquals(p['typestr'], objc._C_INT)
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop2")
        self.assertEquals(p['name'], "prop2")
        self.assertEquals(p['typestr'], objc._C_FLT)
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop3")
        self.assertEquals(p['name'], "prop3")
        self.assertEquals(p['typestr'], b"{s=ic}")
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop4")
        self.assertEquals(p['name'], "prop4")
        self.assertEquals(p['typestr'], objc._C_ID)
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop5")
        self.assertEquals(p['name'], "prop5")
        self.assertEquals(p['typestr'], objc._C_ID)
        self.assertTrue(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop6")
        self.assertEquals(p['name'], "prop6")
        self.assertEquals(p['typestr'], objc._C_ID)
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop7")
        self.assertEquals(p['name'], "prop7")
        self.assertEquals(p['typestr'], objc._C_ID)
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop8")
        self.assertEquals(p['name'], "prop8")
        self.assertEquals(p['typestr'], objc._C_ID)
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertTrue(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop9")
        self.assertEquals(p['name'], "prop9")
        self.assertEquals(p['typestr'], objc._C_ID)
        self.assertFalse(p.get('readonly', False))
        self.assertTrue(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop10")
        self.assertEquals(p['name'], "prop10")
        self.assertEquals(p['typestr'], b"{s=ic}")
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('dynamic', False))

        # This seems to be a bug in the objc runtime:
        #self.assertTrue(p.get('nonatomic', False))

        p = self.get_prop(props, "prop11")
        self.assertEquals(p['name'], "prop11")
        self.assertEquals(p['typestr'], objc._C_ID)
        self.assertFalse(p.get('readonly', False))
        self.assertFalse(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertFalse(p.get('nonatomic', False))
        self.assertEquals(p.get('setter'), b"propSetter:")
        self.assertEquals(p.get('getter'), b"propGetter")
        self.assertFalse(p.get('dynamic', False))

        #p = self.get_prop(props, "prop12")
        #self.assertEquals(p['name'], "prop12")
        #self.assertEquals(p['typestr'], objc._C_ID)
        #self.assertFalse(p.get('readonly', False))
        #self.assertFalse(p.get('copy', False))
        #self.assertTrue(p.get('retain', False))
        #self.assertTrue(p.get('nonatomic', False))
        #self.assertFalse(p.get('dynamic', False))

        p = self.get_prop(props, "prop13")
        self.assertEquals(p['name'], "prop13")
        self.assertEquals(p['typestr'], objc._C_ID)
        self.assertFalse(p.get('readonly', False))
        self.assertTrue(p.get('copy', False))
        self.assertFalse(p.get('retain', False))
        self.assertTrue(p.get('dynamic', False))