Skip to content

Commit

Permalink
test - fix broken test
Browse files Browse the repository at this point in the history
Had a test case for number inputs that I didn't know about.
testmon didn't detect it had to be run.
  • Loading branch information
rouilj committed Jan 18, 2025
1 parent 5ac6e59 commit e7c285d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/test_templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,15 @@ def test_number_field(self):
p = NumberHTMLProperty(self.client, 'testnum', '1', None, 'test',
2345678.2345678)
self.assertEqual(p.field(),
('<input id="testnum1@test" name="testnum1@test" size="30" type="text" '
('<input id="testnum1@test" name="testnum1@test" size="30" type="number" '
'value="%s">')%expected_val)
self.assertEqual(p.field(size=10),
('<input id="testnum1@test" name="testnum1@test" size="10" type="text" '
('<input id="testnum1@test" name="testnum1@test" size="10" type="number" '
'value="%s">')%expected_val)
self.assertEqual(p.field(size=10, dataprop="foo", dataprop2=5),
('<input dataprop="foo" dataprop2="5" '
'id="testnum1@test" name="testnum1@test" '
'size="10" type="text" '
'size="10" type="number" '
'value="%s">'%expected_val))

self.assertEqual(p.field(size=10, klass="class1",
Expand All @@ -369,7 +369,7 @@ def test_number_field(self):
('<input class="class2 class3" data-prop="foo" '
'data-prop2="5" id="testnum1@test" '
'klass="class1" '
'name="testnum1@test" size="10" type="text" '
'name="testnum1@test" size="10" type="number" '
'value="%s">')%expected_val)

# get plain representation if user can't edit
Expand All @@ -378,10 +378,10 @@ def test_number_field(self):

# test with string which is wrong type
p = NumberHTMLProperty(self.client, 'testnum', '1', None, 'test',
"2345678.2345678")
"234567e.2345678")
self.assertEqual(p.field(),
('<input id="testnum1@test" name="testnum1@test" '
'size="30" type="text" value="2345678.2345678">'))
'size="30" type="number" value="234567e.2345678">'))

# test with None value, pretend property.__default_value = Null which
# is the default. It would be returned by get_default_value
Expand All @@ -391,7 +391,7 @@ def test_number_field(self):
'test', None)
self.assertEqual(p.field(),
('<input id="testnum1@test" name="testnum1@test" '
'size="30" type="text" value="">'))
'size="30" type="number" value="">'))

def test_number_plain(self):
import sys
Expand Down Expand Up @@ -768,6 +768,7 @@ def test_DateHTMLWithDate(self):
'deadline', test_Date)
self.assertIsInstance(d._value, date.Date)
self.assertEqual(d.pretty(), " 1 January 2021")
self.assertEqual(d.pretty("%2d %B %Y"), "01 January 2021")
self.assertEqual(d.pretty(format="%Y-%m"), "2021-01")
self.assertEqual(d.plain(), "2021-01-01.13:22:10")
self.assertEqual(d.local("-4").plain(), "2021-01-01.07:22:10")
Expand Down

0 comments on commit e7c285d

Please sign in to comment.