Op 15-04-16 om 18:47 schreef Steven D'Aprano:
> On Fri, 15 Apr 2016 10:48 pm, Antoon Pardon wrote:
>
>> Starting from this:
>>
>> class Test_AVLTree(unittest.TestCase):
>>
>> def test_empty_tree_is_false(self):
>> instance = avltree()
>>
On Sat, Apr 16, 2016 at 2:47 AM, Steven D'Aprano wrote:
> If the tests for your AVL tree and it's subclasses are *identical*, then
> what's the point of the subclasses?
If the tree classes all have the same API but different performance
trade-offs, it would make sense to use
On Fri, 15 Apr 2016 10:48 pm, Antoon Pardon wrote:
> Starting from this:
>
> class Test_AVLTree(unittest.TestCase):
>
> def test_empty_tree_is_false(self):
> instance = avltree()
> self.assertFalse(instance)
>
> Changing it into this:
>
> def
Op 15-04-16 om 13:43 schreef Antoon Pardon:
> Op 15-04-16 om 11:10 schreef Steven D'Aprano:
>> If you have code which is not parameterized, and you want to parameterize
>> it, you have to refactor. Unit tests are no different from anything else.
> I don't agree with that. If I have a piece of code
Op 15-04-16 om 11:10 schreef Steven D'Aprano:
> If you have code which is not parameterized, and you want to parameterize
> it, you have to refactor. Unit tests are no different from anything else.
I don't agree with that. If I have a piece of code that I want to parameterize,
Often enough all I
On Fri, Apr 15, 2016, 11:16 AM Steven D'Aprano wrote:
> On Fri, 15 Apr 2016 06:20 pm, Antoon Pardon wrote:
>
> >>> I see, that's going to be a lot of cut & pastes.
>
> (3) In your editor, run a global Find and Replace "avltree -> self.tree".
> You will need to inspect each
On Fri, 15 Apr 2016 06:20 pm, Antoon Pardon wrote:
class Test_MySubclassTree(Test_AVLTree):
tree = My_Subclass_Tree
>>> I see, that's going to be a lot of cut & pastes.
>>> Thanks.
>> Not really; the first class has all the tests, and the second one is
>> literally just those two lines.
Antoon Pardon writes:
> But the tests, at this moment, are not written to instantiate
> self.tree but to call avltree directly.
That is exactly what the ‘TestCase.setUp’ method is for: to have the
test case class specify how its test cases will customise
On 15.04.16 11:20, Antoon Pardon wrote:
But the tests, at this moment, are not written to instantiate self.tree
but to call avltree directly. So I have to rewrite these tests. That
will IMO involve a lot of cut and paste.
There is yet one approach. Import your original test file, patch it by
On Fri, Apr 15, 2016 at 6:20 PM, Antoon Pardon
wrote:
> But the tests, at this moment, are not written to instantiate self.tree
> but to call avltree directly. So I have to rewrite these tests. That
> will IMO involve a lot of cut and paste.
Ah. In that case, it
On 14.04.16 18:05, Steven D'Aprano wrote:
On Fri, 15 Apr 2016 12:08 am, Antoon Pardon wrote:
I have a unittest for my avltree module.
Now I want this unittest to also run on a subclass of avltree.
How can I organise this, so that I can largely reuse the
original TestCase?
class
Op 15-04-16 om 09:42 schreef Chris Angelico:
> On Fri, Apr 15, 2016 at 4:52 PM, Antoon Pardon
> wrote:
>> Op 14-04-16 om 17:05 schreef Steven D'Aprano:
>>> On Fri, 15 Apr 2016 12:08 am, Antoon Pardon wrote:
>>>
I have a unittest for my avltree module.
On Fri, Apr 15, 2016 at 4:52 PM, Antoon Pardon
wrote:
> Op 14-04-16 om 17:05 schreef Steven D'Aprano:
>> On Fri, 15 Apr 2016 12:08 am, Antoon Pardon wrote:
>>
>>> I have a unittest for my avltree module.
>>>
>>> Now I want this unittest to also run on a subclass of
Op 14-04-16 om 17:05 schreef Steven D'Aprano:
> On Fri, 15 Apr 2016 12:08 am, Antoon Pardon wrote:
>
>> I have a unittest for my avltree module.
>>
>> Now I want this unittest to also run on a subclass of avltree.
>> How can I organise this, so that I can largely reuse the
>> original TestCase?
>
On Fri, 15 Apr 2016 12:08 am, Antoon Pardon wrote:
>
> I have a unittest for my avltree module.
>
> Now I want this unittest to also run on a subclass of avltree.
> How can I organise this, so that I can largely reuse the
> original TestCase?
class Test_AVLTree(unittest.TestCase):
tree =
2016-04-14 16:08 GMT+02:00 Antoon Pardon :
>
> I have a unittest for my avltree module.
>
> Now I want this unittest to also run on a subclass of avltree.
> How can I organise this, so that I can largely reuse the
> original TestCase?
>
> --
> Antoon Pardon
> --
>
I have a unittest for my avltree module.
Now I want this unittest to also run on a subclass of avltree.
How can I organise this, so that I can largely reuse the
original TestCase?
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list
17 matches
Mail list logo