How to use set_target method in yandex-tank

Best Python code snippet using yandex-tank

test_cardrules.py

Source:test_cardrules.py Github

copy

Full Screen

...5 def setUp(self):6 deck = Deck()7 self.card_rules = CardRules(deck)8 def test_reject_straight(self):9 self.card_rules.set_target('J')10 hand = ['7s','9c','10c','8s','Jd']11 self.assertFalse(self.card_rules.check_success(hand))12 def test_reject_flush(self):13 self.card_rules.set_target('9')14 hand = ['7c','9c','6c','5c','2c']15 self.assertFalse(self.card_rules.check_success(hand))16 def test_reject_pairs(self):17 self.card_rules.set_target('8')18 hand = ['7c','8c','7s','5c','2c']19 self.assertFalse(self.card_rules.check_success(hand))20 def test_reject_trips(self):21 self.card_rules.set_target('8')22 hand = ['7c','7d','7s','5c','2c']23 self.assertFalse(self.card_rules.check_success(hand))24 def test_reject_quads(self):25 self.card_rules.set_target('8')26 hand = ['5h','5d','5s','5c','2c']27 self.assertFalse(self.card_rules.check_success(hand))28 def test_reject_full_house(self):29 self.card_rules.set_target('8')30 hand = ['5h','5d','5s','2c','2h']31 self.assertFalse(self.card_rules.check_success(hand))32 def test_reject_high_cards(self):33 # one high card34 self.card_rules.set_target('10')35 hand = ['7c','9c','Js','5c','2c']36 self.assertFalse(self.card_rules.check_success(hand))37 # two high cards38 self.card_rules.set_target('8')39 hand = ['7c','9c','Js','5h','Kc']40 self.assertFalse(self.card_rules.check_success(hand))41 def test_accept_valid_hand(self):42 # valid with highest card == target43 self.card_rules.set_target('10')44 hand = ['7c','9c','10s','5h','8c']45 self.assertTrue(self.card_rules.check_success(hand))46 # valid with highest card < target47 self.card_rules.set_target('10')48 hand = ['7c','9c','2s','5h','8c']49 self.assertTrue(self.card_rules.check_success(hand))50class CardRulesCardsRemovalTests(unittest.TestCase):51 def setUp(self):52 deck = Deck()53 self.card_rules = CardRules(deck)54 def test_remove_high_cards(self):55 self.card_rules.set_target('10')56 hand = ['7c','9c','Js','Kh','8c']57 retained_cards = self.card_rules.apply_rules(hand)58 expected_cards = ['7c','9c','8c']59 self.assertTrue(set(retained_cards)==set(expected_cards))60 def test_remove_pair_of_dominant_suit(self):61 # given a pair, the card from the dominant suit should be removed62 self.card_rules.set_target('J')63 hand = ['7c','9c','9s','6h','8c']64 retained_cards = self.card_rules.apply_rules(hand)65 expected_cards = ['7c','9s','6h','8c']66 self.assertTrue(set(retained_cards)==set(expected_cards))67 def test_remove_pair_of_dominant_suit2(self):68 # when there are no dominant suit (or equality of suits) the second pair card69 # gets removed70 self.card_rules.set_target('J')71 hand = ['7c','9c','9s','6s','8h']72 retained_cards = self.card_rules.apply_rules(hand)73 expected_cards = ['7c','9c','6s','8h']74 self.assertTrue(set(retained_cards)==set(expected_cards))75 def test_remove_second_high_card_given_a_straight(self):76 self.card_rules.set_target('J')77 hand = ['8c','7c','5s','6s','4h']78 retained_cards = self.card_rules.apply_rules(hand)79 expected_cards = ['8c','5s','6s','4h']80 self.assertTrue(set(retained_cards)==set(expected_cards))81 def test_remove_second_high_card_given_a_flush(self):82 self.card_rules.set_target('J')83 hand = ['10c','8c','5c','6c','4c']84 retained_cards = self.card_rules.apply_rules(hand)85 expected_cards = ['10c','5c','6c','4c']...

Full Screen

Full Screen

fit_data.py

Source:fit_data.py Github

copy

Full Screen

1from sklearn import linear_model2import arisu_data3class FitData(arisu_data.ArisuData):4 def fit(self):5 set_feature, set_target = self.__get_features_target()6 regs = []7 for idx in range(5):8 regs.append(linear_model.LinearRegression())9 regs[idx].fit(set_feature[idx], set_target[idx])10 for aq in self.arisuqs:11 if not aq.is_loss:12 continue13 idx, features = aq.get_lossy_features()14 est = regs[idx - 1].predict([features])15 aq.set_feature(idx, est[0])16 def __get_features_target(self):17 set_feature = [[], [], [], [], []]18 set_target = [[], [], [], [], []]19 for aq in self.arisuqs:20 if aq.is_loss:21 continue22 features = aq.get_features()23 set_feature[0].append(features[1:])24 set_target[0].append(features[0])25 set_feature[1].append(features[0:1] + features[2:])26 set_target[1].append(features[1])27 set_feature[2].append(features[0:2] + features[3:])28 set_target[2].append(features[2])29 set_feature[3].append(features[0:3] + features[4:])30 set_target[3].append(features[3])31 set_feature[4].append(features[0:4])32 set_target[4].append(features[4])...

Full Screen

Full Screen

hlc_test.py

Source:hlc_test.py Github

copy

Full Screen

...12t1 = Target((1,0),0)13t2 = Target((0,-0.5),0)14delay = 11516hlc.set_target(t1)17sleep(delay)18hlc.set_target(t2)19sleep(delay)20hlc.set_target(t1)21sleep(delay)22hlc.set_target(t2)23sleep(delay)24hlc.set_target(t1)25sleep(delay)26hlc.set_target(t2)27sleep(delay)28hlc.set_target(t1)29sleep(delay)3031for i in range(0,1000):32 sleep(0.05)33 hlc.set_target(t1)34 sleep(0.05)35 hlc.set_target(t2)36 ...

Full Screen

Full Screen

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 yandex-tank 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