« first day (748 days earlier)      last day (2830 days later) » 

15:11
Someone kicked me out of roo
Stop
2 messages moved from Python
 
1 hour later…
user6845426
16:41
get Trump to :D
1 message moved from Python
 
2 hours later…
wim
wim
19:09
there are all kinds of wacky names, you just look in pypi.python.org/simple
1 message moved from Python
 
4 hours later…
anu
anu
23:14
import unittest

class WidgetTestCase(unittest.TestCase):
    def setUp(self):
        self.widget = Widget('The widget')

    def tearDown(self):
        self.widget.dispose()
        self.widget = None

    def test_default_size(self):
        self.assertEqual(self.widget.size(), (50,50),
                         'incorrect default size')

    def test_resize(self):
        self.widget.resize(100,150)
        self.assertEqual(self.widget.size(), (100,150),
                         'wrong size after resize')
that's the example i m using to create my setup method.
from MyQueue import MyQueue
import unittest


class test_MyQueue(unittest.TestCase):
	def setup(self):
		self.q1 = Queue()
		self.q2 = Queue([1,2,3])

	def test_queue_init(self):
		self.assertIsNone(self.q1.peek(),"q1's head of queue is None")
		self.assertIsNotNone(self.q2.peek(),"q2's head of queue is not None")
		self.assertEqual(self.q2.peek(),1,"q2.peek() == 1")
		self.assertEqual(self.q1.size(),0)
		self.assertEqual(self.q2.size(),3)

	def test_queue_enqueue(self):
		self.q1.enqueue(10)
		self.assertEqual(self.q1.size(),1)
but my tests error out.
Anupams-MacBook-Pro:test anupamkumar$ python test_MyQueue.py
EEE
======================================================================
ERROR: test_queue_dequeue (__main__.test_MyQueue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_MyQueue.py", line 23, in test_queue_dequeue
    self.assertEqual(self.q2.dequeue(),1)
AttributeError: 'test_MyQueue' object has no attribute 'q2'

======================================================================
ok ... nevermind i figured it out
it's setUp not setup
23:59
7 messages moved from Python

« first day (748 days earlier)      last day (2830 days later) »