Skip to content

Instantly share code, notes, and snippets.

View gahcep's full-sized avatar

Sergei Danielian gahcep

View GitHub Profile
@gahcep
gahcep / pyexample_2_1.py
Created February 10, 2013 13:34
Article 'QA in Python - working with unittest'
import unittest
class FirstTestClass(unittest.TestCase):
def test_add(self):
self.assertEquals(120, 100 + 20)
class SecondTestClass(unittest.TestCase):
def setUp(self):
@gahcep
gahcep / thrift_client.cs
Created March 13, 2013 17:26
Article 'Server-Client RPC via Apache Thrift'
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Thrift;
using Thrift.Transport;
using Thrift.Protocol;
using Calc.Simple;
@gahcep
gahcep / thrift_server.py
Created March 10, 2013 17:11
Article 'Server-Client RPC via Apache Thrift'
import sys
sys.path.append("./gen-py")
# Thrift facility
from thrift.protocol import TBinaryProtocol
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.server import TServer
# CalcService
@gahcep
gahcep / launcher.py
Created February 10, 2013 14:54
Article 'QA in Python - working with unittest'
import unittest
loader = unittest.TestLoader()
suite = loader.discover(start_dir='.', pattern='pyexample_*.py')
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
@gahcep
gahcep / pyexample_6_module_b.py
Created February 10, 2013 14:38
Article 'QA in Python - working with unittest'
import unittest
class ClassB(unittest.TestCase):
def test_add_b(self):
self.assertEquals(120, 100 + 20)
def test_sub_b(self):
self.assertEquals(210, 230 - 20)
@gahcep
gahcep / pyexample_6.py
Created February 10, 2013 14:37
Article 'QA in Python - working with unittest'
import unittest
import pyexample_6_module_a
import pyexample_6_module_b
loader = unittest.TestLoader()
suite = loader.loadTestsFromModule(pyexample_6_module_a)
suite.addTests(loader.loadTestsFromModule(pyexample_6_module_b))
@gahcep
gahcep / pyexample_6_module_a.py
Created February 10, 2013 14:38
Article 'QA in Python - working with unittest'
import unittest
class ClassA(unittest.TestCase):
def test_add_a(self):
self.assertEquals(120, 100 + 20)
def test_sub_a(self):
self.assertEquals(210, 230 - 20)
@gahcep
gahcep / pyexample_5_inheritance.py
Created February 10, 2013 14:14
Article 'QA in Python - working with unittest'
import unittest
class BaseTestClass(unittest.TestCase):
def test_base_1(self):
self.assertEquals(210, 110 * 2 - 10)
def test_base_2(self):
self.assertTrue(False is not None)
@gahcep
gahcep / pyexample_5_multiple_inher.py
Created February 10, 2013 14:14
Article 'QA in Python - working with unittest'
import unittest
class BaseTestClass(object):
def test_base_1(self):
self.assertEquals(210, 110 * 2 - 10)
def test_base_2(self):
self.assertTrue(False is not None)
@gahcep
gahcep / pyexample_1.py
Created February 10, 2013 13:31
Article 'QA in Python - working with unittest'
import unittest
class BaseTestClass(unittest.TestCase):
def test_add(self):
self.assertEquals(120, 100 + 20)
self.assertFalse(10 > 20)
self.assertGreater(120, 100)
def test_sub(self):