This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
from random import randint | |
def data_generator(): | |
# some logic | |
return [_ * randint(0, 10) for _ in range(10)] | |
class TestClass(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
from collections import OrderedDict | |
msg = """If web server returns any error message | |
for any query by application server | |
then application server should catch and display | |
these error messages appropriately to the users""" | |
items = OrderedDict([(_, Counter(_)) for _ in msg.split()]) | |
cleared = zip(*filter(lambda (k, v): len(v.values()) == sum(v.values()), items.iteritems()))[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
class BaseTest(unittest.TestCase): | |
def setUp(self): | |
print('setup') | |
def tearDown(self): | |
print('tear down') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def convert_blocks_to_lists(list): | |
block_length = int(math.sqrt(len(list))) | |
squares = [] | |
for i in range(0,len(list),block_length): | |
for j in range(0,len(list),block_length): | |
squares.append([item for x in range (i,i+block_length) for item in list[x][j:j+block_length]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
class Driver(object): | |
__instance = None | |
@classmethod | |
def get(cls, type='ff'): | |
if not cls.__instance: | |
cls.__instance = webdriver.Firefox() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
class BaseTest(object): | |
@pytest.fixture(scope="class", autouse=True) | |
def manage_driver(self, request, driver): | |
driver.start() | |
request.addfinalizer(driver.stop) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[sites] | |
base_site = testsite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_data_creation (__main__.TestServerFunctionality) ... ok | |
test_data_creation_incorrect_header (__main__.TestServerFunctionality) ... ok | |
test_data_retrieve (__main__.TestServerFunctionality) ... ok | |
test_delete (__main__.TestServerFunctionality) ... ok | |
---------------------------------------------------------------------- | |
Ran 4 tests in 3.170s | |
OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ApplicationState = None [ObjectifiedElement] | |
* xsi:noNamespaceSchemaLocation = 'ApplicationState.xsd' | |
appState = 'PRE_RACE' [StringElement] | |
eventId = 3625 [IntElement] | |
trackId = 713 [IntElement] | |
NextEventId = 3621 [IntElement] | |
PastEventId = 3627 [IntElement] | |
PRE_RACE | |
3625 | |
713 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
def main(): | |
usage = """ | |
You should pass at least 1 argument to %s | |
Arguments are folders full path separated by space. | |
""" % sys.argv[0] |
NewerOlder