

def test_negative_admin_fee_attendance(self):
    'Ensure we disallow negative admin fee or attendance.\n\n        This is a regression test for\n        https://github.com/swcarpentry/amy/issues/435.'
    error_str = 'Ensure this value is greater than or equal to 0.'
    data = {
        'host': self.test_host.id,
        'tags': [self.test_tag.id],
        'slug': 'test-event',
        'admin_fee': (- 1200),
        'invoice_status': 'unknown',
    }
    f = EventForm(data)
    self.assertIn('admin_fee', f.errors)
    self.assertIn(error_str, f.errors['admin_fee'])
    del data['admin_fee']
    data['attendance'] = (- 36)
    f = EventForm(data)
    self.assertIn('attendance', f.errors)
    self.assertIn(error_str, f.errors['attendance'])
    data['admin_fee'] = 0
    data['attendance'] = 0
    f = EventForm(data)
    self.assertNotIn('admin_fee', f.errors)
    f.assertNotIn('attendance', f.errors)
    data['slug'] = 'test-event2'
    data['admin_fee'] = 1200
    data['attendance'] = 36
    f = EventForm(data)
    self.assertTrue(f.is_valid())

dataset/ETHPy150Open swcarpentry/amy/workshops/test/test_event.py TestEventViews.test_negative_admin_fee_attendance/VarMisuse@172/323 `self`->`f`