Skip to content

Commit 7def2c5

Browse files
Eldinnietsnoam
authored andcommitted
fix tests for pycharm windows
Refractored self.id in new tests to self._id (as I did before) so testrunner in pycharm can run under Windows.
1 parent 09230e6 commit 7def2c5

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

tests/test_precheckoutquery.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PreCheckoutQueryTest(BaseTest, unittest.TestCase):
3232
"""This object represents Tests for Telegram PreCheckoutQuery."""
3333

3434
def setUp(self):
35-
self.id = 5
35+
self._id = 5
3636
self.invoice_payload = 'invoice_payload'
3737
self.shipping_option_id = 'shipping_option_id'
3838
self.currency = 'EUR'
@@ -41,7 +41,7 @@ def setUp(self):
4141
self.order_info = telegram.OrderInfo()
4242

4343
self.json_dict = {
44-
'id': self.id,
44+
'id': self._id,
4545
'invoice_payload': self.invoice_payload,
4646
'shipping_option_id': self.shipping_option_id,
4747
'currency': self.currency,
@@ -53,7 +53,7 @@ def setUp(self):
5353
def test_precheckoutquery_de_json(self):
5454
precheckoutquery = telegram.PreCheckoutQuery.de_json(self.json_dict, self._bot)
5555

56-
self.assertEqual(precheckoutquery.id, self.id)
56+
self.assertEqual(precheckoutquery.id, self._id)
5757
self.assertEqual(precheckoutquery.invoice_payload, self.invoice_payload)
5858
self.assertEqual(precheckoutquery.shipping_option_id, self.shipping_option_id)
5959
self.assertEqual(precheckoutquery.currency, self.currency)
@@ -72,14 +72,14 @@ def test_precheckoutquery_to_dict(self):
7272
self.assertDictEqual(self.json_dict, precheckoutquery)
7373

7474
def test_equality(self):
75-
a = telegram.PreCheckoutQuery(self.id, self.from_user, self.currency, self.total_amount,
75+
a = telegram.PreCheckoutQuery(self._id, self.from_user, self.currency, self.total_amount,
7676
self.invoice_payload)
77-
b = telegram.PreCheckoutQuery(self.id, self.from_user, self.currency, self.total_amount,
77+
b = telegram.PreCheckoutQuery(self._id, self.from_user, self.currency, self.total_amount,
7878
self.invoice_payload)
79-
c = telegram.PreCheckoutQuery(self.id, None, '', 0, '')
79+
c = telegram.PreCheckoutQuery(self._id, None, '', 0, '')
8080
d = telegram.PreCheckoutQuery(0, self.from_user, self.currency, self.total_amount,
8181
self.invoice_payload)
82-
e = telegram.Update(self.id)
82+
e = telegram.Update(self._id)
8383

8484
self.assertEqual(a, b)
8585
self.assertEqual(hash(a), hash(b))

tests/test_shippingoption.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ class ShippingOptionTest(BaseTest, unittest.TestCase):
3232
"""This object represents Tests for Telegram ShippingOption."""
3333

3434
def setUp(self):
35-
self.id = 'id'
35+
self._id = 'id'
3636
self.title = 'title'
3737
self.prices = [
3838
telegram.LabeledPrice('Fish Container', 100),
3939
telegram.LabeledPrice('Premium Fish Container', 1000)
4040
]
4141

4242
self.json_dict = {
43-
'id': self.id,
43+
'id': self._id,
4444
'title': self.title,
4545
'prices': [x.to_dict() for x in self.prices]
4646
}
4747

4848
def test_shippingoption_de_json(self):
4949
shippingoption = telegram.ShippingOption.de_json(self.json_dict, self._bot)
5050

51-
self.assertEqual(shippingoption.id, self.id)
51+
self.assertEqual(shippingoption.id, self._id)
5252
self.assertEqual(shippingoption.title, self.title)
5353
self.assertEqual(shippingoption.prices, self.prices)
5454

@@ -64,11 +64,11 @@ def test_shippingoption_to_dict(self):
6464
self.assertDictEqual(self.json_dict, shippingoption)
6565

6666
def test_equality(self):
67-
a = telegram.ShippingOption(self.id, self.title, self.prices)
68-
b = telegram.ShippingOption(self.id, self.title, self.prices)
69-
c = telegram.ShippingOption(self.id, '', [])
67+
a = telegram.ShippingOption(self._id, self.title, self.prices)
68+
b = telegram.ShippingOption(self._id, self.title, self.prices)
69+
c = telegram.ShippingOption(self._id, '', [])
7070
d = telegram.ShippingOption(0, self.title, self.prices)
71-
e = telegram.Voice(self.id, 0)
71+
e = telegram.Voice(self._id, 0)
7272

7373
self.assertEqual(a, b)
7474
self.assertEqual(hash(a), hash(b))

tests/test_shippingquery.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ class ShippingQueryTest(BaseTest, unittest.TestCase):
3232
"""This object represents Tests for Telegram ShippingQuery."""
3333

3434
def setUp(self):
35-
self.id = 5
35+
self._id = 5
3636
self.invoice_payload = 'invoice_payload'
3737
self.from_user = telegram.User(0, '')
3838
self.shipping_address = telegram.ShippingAddress('GB', '', 'London', '12 Grimmauld Place',
3939
'', 'WC1')
4040

4141
self.json_dict = {
42-
'id': self.id,
42+
'id': self._id,
4343
'invoice_payload': self.invoice_payload,
4444
'from': self.from_user.to_dict(),
4545
'shipping_address': self.shipping_address.to_dict()
@@ -48,7 +48,7 @@ def setUp(self):
4848
def test_shippingquery_de_json(self):
4949
shippingquery = telegram.ShippingQuery.de_json(self.json_dict, self._bot)
5050

51-
self.assertEqual(shippingquery.id, self.id)
51+
self.assertEqual(shippingquery.id, self._id)
5252
self.assertEqual(shippingquery.invoice_payload, self.invoice_payload)
5353
self.assertEqual(shippingquery.from_user, self.from_user)
5454
self.assertEqual(shippingquery.shipping_address, self.shipping_address)
@@ -65,13 +65,13 @@ def test_shippingquery_to_dict(self):
6565
self.assertDictEqual(self.json_dict, shippingquery)
6666

6767
def test_equality(self):
68-
a = telegram.ShippingQuery(self.id, self.from_user, self.invoice_payload,
68+
a = telegram.ShippingQuery(self._id, self.from_user, self.invoice_payload,
6969
self.shipping_address)
70-
b = telegram.ShippingQuery(self.id, self.from_user, self.invoice_payload,
70+
b = telegram.ShippingQuery(self._id, self.from_user, self.invoice_payload,
7171
self.shipping_address)
72-
c = telegram.ShippingQuery(self.id, None, '', None)
72+
c = telegram.ShippingQuery(self._id, None, '', None)
7373
d = telegram.ShippingQuery(0, self.from_user, self.invoice_payload, self.shipping_address)
74-
e = telegram.Update(self.id)
74+
e = telegram.Update(self._id)
7575

7676
self.assertEqual(a, b)
7777
self.assertEqual(hash(a), hash(b))

0 commit comments

Comments
 (0)