mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-11 03:48:03 +00:00
@@ -91,9 +91,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from __future__ import division\n",
|
||||
@@ -130,9 +128,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -144,21 +140,21 @@
|
||||
],
|
||||
"source": [
|
||||
"%%writefile test_print_binary.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestBits(object):\n",
|
||||
"class TestBits(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_print_binary(self):\n",
|
||||
" bit = Bits()\n",
|
||||
" assert_equal(bit.print_binary(None), 'ERROR')\n",
|
||||
" assert_equal(bit.print_binary(0), 'ERROR')\n",
|
||||
" assert_equal(bit.print_binary(1), 'ERROR')\n",
|
||||
" self.assertEqual(bit.print_binary(None), 'ERROR')\n",
|
||||
" self.assertEqual(bit.print_binary(0), 'ERROR')\n",
|
||||
" self.assertEqual(bit.print_binary(1), 'ERROR')\n",
|
||||
" num = 0.625\n",
|
||||
" expected = '0.101'\n",
|
||||
" assert_equal(bit.print_binary(num), expected)\n",
|
||||
" self.assertEqual(bit.print_binary(num), expected)\n",
|
||||
" num = 0.987654321\n",
|
||||
" assert_equal(bit.print_binary(num), 'ERROR')\n",
|
||||
" self.assertEqual(bit.print_binary(num), 'ERROR')\n",
|
||||
" print('Success: test_print_binary')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -174,9 +170,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -207,9 +201,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user