How to use add_attributes method in autotest

Best Python code snippet using autotest_python

test_entity.py

Source: test_entity.py Github

copy

Full Screen

...9 Entity(" PARTICIPANT: numero, nom, adresse "),10 Entity("PARTICIPANT :numero ,nom ,adresse"),11 ]12 for e in entities:13 e.add_attributes([])14 self.assertEqual(e.name, "PARTICIPANT")15 self.assertEqual(e.name_view, "PARTICIPANT")16 self.assertEqual([a.label for a in e.attributes], ["numero", "nom", "adresse"])17 self.assertEqual([a.get_category() for a in e.attributes], ["strong", "simple", "simple"])18 def test_data_types(self):19 e = Entity("PARTICIPANT: numero [type1], nom [type2] , adresse[type3]")20 e.add_attributes([])21 self.assertEqual([a.label for a in e.attributes], ["numero", "nom", "adresse"])22 self.assertEqual([a.data_type for a in e.attributes], ["type1", "type2", "type3"])23 e = Entity("PARTICIPANT: numero [type a,b,c], nom [type2], adresse [type3]")24 e.add_attributes([])25 self.assertEqual([a.data_type for a in e.attributes], ["type a,b,c", "type2", "type3"])26 e = Entity("PARTICIPANT: numero [], nom, adresse [type3]")27 e.add_attributes([])28 self.assertEqual([a.data_type for a in e.attributes], ["", None, "type3"])29 e = Entity("PARTICIPANT: numero [, nom, adresse")30 e.add_attributes([])31 self.assertEqual([a.data_type for a in e.attributes], [None, None, None])32 def test_numbered_entity(self):33 e = Entity("PARTICIPANT5: numero, nom, adresse")34 e.add_attributes([])35 self.assertEqual(e.name, "PARTICIPANT5")36 self.assertEqual(e.name_view, "PARTICIPANT")37 def test_blank(self):38 e = Entity("MOT-CLEF: mot-clé, ,")39 e.add_attributes([])40 self.assertEqual([a.label for a in e.attributes], ["mot-clé", "", ""])41 self.assertEqual([a.get_category() for a in e.attributes], ["strong", "phantom", "phantom"])42 def test_all_blank(self):43 e = Entity("BLANK: , ,")44 e.add_attributes([])45 self.assertEqual([a.label for a in e.attributes], ["", "", ""])46 self.assertEqual([a.get_category() for a in e.attributes], ["phantom", "phantom", "phantom"])47 def test_no_identifier_at_first_position(self):48 e = Entity("POSITION: _abscisse, ordonnee")49 e.add_attributes([])50 self.assertEqual([a.label for a in e.attributes], ["abscisse", "ordonnee"])51 self.assertEqual([a.get_category() for a in e.attributes], ["simple", "simple"])52 def test_no_identifier_for_children(self):53 e = Entity("POSITION: abscisse, _ordonnee")54 e.add_attributes([], is_child=True)55 self.assertEqual([a.label for a in e.attributes], ["abscisse", "ordonnee"])56 self.assertEqual([a.get_category() for a in e.attributes], ["simple", "simple"])57 def test_multiple_strong_identifier(self):58 e = Entity("POSITION: abscisse, _ordonnee")59 e.add_attributes([])60 self.assertEqual([a.label for a in e.attributes], ["abscisse", "ordonnee"])61 self.assertEqual([a.get_category() for a in e.attributes], ["strong", "strong"])62 def test_weak_identifier(self):63 e = Entity("LIVRE: Num. exemplaire, Etat du livre, Date d'achat")64 e.add_attributes(["placeholder"])65 self.assertEqual([a.label for a in e.attributes], ["Num. exemplaire", "Etat du livre", "Date d'achat"])66 self.assertEqual([a.get_category() for a in e.attributes], ["weak", "simple", "simple"])67 def test_weak_composite_identifier(self):68 e = Entity("POSITION: abscisse, _ordonnee, foobar")69 e.add_attributes(["placeholder"])70 self.assertEqual([a.label for a in e.attributes], ["abscisse", "ordonnee", "foobar"])71 self.assertEqual([a.get_category() for a in e.attributes], ["weak", "weak", "simple"])72 def test_backslash_suppression(self):73 e = Entity("PARTICIPANT\: numero\, \tnom\t, ad\\resse")74 e.add_attributes([])75 self.assertEqual(e.name, "PARTICIPANT")76 self.assertEqual(e.name_view, "PARTICIPANT")77 self.assertEqual([a.label for a in e.attributes], ["numero", "nom", "adresse"])78if __name__ == '__main__':...

Full Screen

Full Screen

displayer.py

Source: displayer.py Github

copy

Full Screen

...5import numpy as np6class NSGANetDisplay(Display):7 def _do(self, ga):8 self.display_top = -19 self.add_attributes('n_gens', ga.n_gens) 10 self.add_attributes('n_evals', ga.n_evals) 11 self.add_attributes('error_rate', ga.F_pop[ga.elite_idx])12 self.add_attributes('flops', ga.F_pop[ga.elite_idx])13 now = time.time()14 self.add_attributes('time', now - ga.start_time)15 self.add_attributes('architecture', ga.pop[ga.elite_idx])16class SODisplay(Display):17 def _do(self, algorithm):18 self.display_top = 1019 self.add_attributes('mean', algorithm.fitness_pop.mean())20 self.add_attributes('std', algorithm.fitness_pop.std())21 self.add_attributes('n_gens', algorithm.n_gens)22 self.add_attributes('n_evals', algorithm.n_evals)23 self.add_attributes('elite', algorithm.pop[algorithm.elite_idx])24def print_info(self):25 n_params = (np.sum(np.prod(v.size()) for v in filter(lambda p: p.requires_grad, self.model.parameters())) /​ 1e6)26 self.model = add_flops_counting_methods(self.model)27 self.model.eval()28 self.model.start_flops_count()29 random_data = torch.randn(1, *self.data_info['input_size'])30 self.model(torch.autograd.Variable(random_data).to(self.device))31 n_flops = np.round(self.model.compute_average_flops_cost() /​ 1e6, 4)...

Full Screen

Full Screen

logger.py

Source: logger.py Github

copy

Full Screen

1import time2from model.log_saver import LogSaver3class NSGANetLogSaver(LogSaver):4 def _do(self, ga):5 self.add_attributes('architecture', ga.pop[ga.elite_idx])6 self.add_attributes('error_rate', ga.F_pop[ga.elite_idx])7 self.add_attributes('flops', ga.F_pop[ga.elite_idx])8 self.add_attributes('n_gens', ga.n_gens) 9 self.add_attributes('n_evals', ga.n_evals) 10 11 now = time.time()12 self.add_attributes('time', now - ga.start_time)13class SOLogSaver(LogSaver):14 def _do(self, algorithm):15 self.add_attributes('mean', algorithm.fitness_pop.mean())16 self.add_attributes('std', algorithm.fitness_pop.std())17 self.add_attributes('n_gens', algorithm.n_gens)18 self.add_attributes('n_evals', algorithm.n_evals)...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Scala Testing: A Comprehensive Guide

Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.

What Agile Testing (Actually) Is

So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.

How To Choose The Right Mobile App Testing Tools

Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools

A Complete Guide To CSS Houdini

As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????

Appium Testing Tutorial For Mobile Applications

The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful