Best Python code snippet using Kiwi_python
unittest_checker_typecheck.py
Source: unittest_checker_typecheck.py
...40 Message(41 'no-member',42 node=node,43 args=('Module', 'optparse', 'THIS_does_not_EXIST', ''))):44 self.checker.visit_attribute(node)45 @set_config(ignored_modules=('argparse',))46 def test_no_member_in_getattr_ignored(self):47 """Make sure that a module attribute access check is omitted with a48 module that is configured to be ignored.49 """50 node = astroid.extract_node("""51 import argparse52 argparse.THIS_does_not_EXIST53 """)54 with self.assertNoMessages():55 self.checker.visit_attribute(node)56 @set_config(ignored_classes=('xml.etree.', ))57 def test_ignored_modules_invalid_pattern(self):58 node = astroid.extract_node('''59 import xml60 xml.etree.Lala61 ''')62 message = Message('no-member', node=node,63 args=('Module', 'xml.etree', 'Lala', ''))64 with self.assertAddsMessages(message):65 self.checker.visit_attribute(node)66 @set_config(ignored_modules=('xml.etree*', ))67 def test_ignored_modules_patterns(self):68 node = astroid.extract_node('''69 import xml70 xml.etree.portocola #@71 ''')72 with self.assertNoMessages():73 self.checker.visit_attribute(node)74 @set_config(ignored_classes=('xml.*', ))75 def test_ignored_classes_no_recursive_pattern(self):76 node = astroid.extract_node('''77 import xml78 xml.etree.ElementTree.Test79 ''')80 message = Message('no-member', node=node,81 args=('Module', 'xml.etree.ElementTree', 'Test', ''))82 with self.assertAddsMessages(message):83 self.checker.visit_attribute(node)84 @set_config(ignored_classes=('optparse.Values', ))85 def test_ignored_classes_qualified_name(self):86 """Test that ignored-classes supports qualified name for ignoring."""87 node = astroid.extract_node('''88 import optparse89 optparse.Values.lala90 ''')91 with self.assertNoMessages():92 self.checker.visit_attribute(node)93 @set_config(ignored_classes=('Values', ))94 def test_ignored_classes_only_name(self):95 """Test that ignored_classes works with the name only."""96 node = astroid.extract_node('''97 import optparse98 optparse.Values.lala99 ''')100 with self.assertNoMessages():101 self.checker.visit_attribute(node)102 @set_config(suggestion_mode=False)103 @needs_c_extension104 def test_nomember_on_c_extension_error_msg(self):105 node = astroid.extract_node('''106 from coverage import tracer107 tracer.CTracer #@108 ''')109 message = Message('no-member', node=node,110 args=('Module', 'coverage.tracer', 'CTracer', ''))111 with self.assertAddsMessages(message):112 self.checker.visit_attribute(node)113 @set_config(suggestion_mode=True)114 @needs_c_extension115 def test_nomember_on_c_extension_info_msg(self):116 node = astroid.extract_node('''117 from coverage import tracer118 tracer.CTracer #@119 ''')120 message = Message('c-extension-no-member', node=node,121 args=('Module', 'coverage.tracer', 'CTracer', ''))122 with self.assertAddsMessages(message):123 self.checker.visit_attribute(node)124 @set_config(contextmanager_decorators=('contextlib.contextmanager',125 '.custom_contextmanager'))126 def test_custom_context_manager(self):127 """Test that @custom_contextmanager is recognized as configured."""128 node = astroid.extract_node('''129 from contextlib import contextmanager130 def custom_contextmanager(f):131 return contextmanager(f)132 @custom_contextmanager133 def dec():134 yield135 with dec():136 pass137 ''')...
visit.py
Source: visit.py
...16 """Visit each node in the model, natural order."""17 self.model = model18 for en in model.entities:19 for at in en.attributes:20 self.visit_attribute(at)21 self.visit_entity(en)22 for ix in en.indexes:23 self.visit_index(ix)24 for re in model.relationships:25 for at in re.attributes:26 self.visit_attribute(at)27 self.visit_relationship(re)28 for ix in re.indexes:29 self.visit_index(ix)30 for vi in model.views:31 self.visit_view(vi)32 self.visit_model(model)33 def visit_reversed(self, model):34 """Visit each node in the model, reversed."""35 self.model = model36 self.visit_model(model)37 for vi in model.views:38 self.visit_view(vi)39 for re in model.relationships:40 for ix in re.indexes:41 self.visit_index(ix)42 self.visit_relationship(re)43 for at in re.attributes:44 self.visit_attribute(at)45 for en in model.entities:46 for ix in en.indexes:47 self.visit_index(ix)48 self.visit_entity(en)49 for at in en.attributes:50 self.visit_attribute(at)51 def visit_attribute(self, attrbute):52 pass53 def visit_index(self, index):54 pass55 def visit_entity(self, entity):56 pass57 def visit_relationship(self, relationship):58 pass59 def visit_view(self, view):60 pass61 def visit_model(self, model):...
Check out the latest blogs from LambdaTest on this topic:
Howdy testers! If you’re reading this article I suggest you keep a diary & a pen handy because we’ve added numerous exciting features to our cross browser testing cloud and I am about to share them with you right away!
Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.
There are times when developers get stuck with a problem that has to do with version changes. Trying to run the code or test without upgrading the package can result in unexpected errors.
Greetings folks! With the new year finally upon us, we’re excited to announce a collection of brand-new product updates. At LambdaTest, we strive to provide you with a comprehensive test orchestration and execution platform to ensure the ultimate web and mobile experience.
Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on a new technology so soon.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!