mirror of
https://github.com/androguard/androguard.git
synced 2024-11-23 05:00:11 +00:00
31 lines
845 B
Python
31 lines
845 B
Python
import os
|
|
import unittest
|
|
|
|
from androguard.core.dex import DEX
|
|
|
|
test_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
class AnnotationTest(unittest.TestCase):
|
|
def testAnnotation(self):
|
|
with open(
|
|
os.path.join(test_dir, 'data/APK/Annotation_classes.dex'), "rb"
|
|
) as f:
|
|
d = DEX(f.read())
|
|
|
|
clazz = d.get_class(
|
|
'Landroid/support/v4/widget/SlidingPaneLayout$SlidingPanelLayoutImplJB;'
|
|
)
|
|
annotations = clazz._get_annotation_type_ids()
|
|
self.assertIn(
|
|
'Landroid/support/annotation/RequiresApi;',
|
|
[
|
|
clazz.CM.get_type(annotation.type_idx)
|
|
for annotation in annotations
|
|
],
|
|
)
|
|
|
|
self.assertIn(
|
|
'Landroid/support/annotation/RequiresApi;', clazz.get_annotations()
|
|
)
|